starting to add proper header file with declaration of standard functions
authorMario de Sousa <msousa@fe.up.pt>
Mon, 04 Apr 2011 10:42:03 +0100
changeset 267 0a1204bcc9af
parent 266 2f6d8866ec8d
child 268 1eba01e3fb70
starting to add proper header file with declaration of standard functions
absyntax/absyntax.def
lib/create_standard_function_header.sh
lib/ieclib.txt
lib/standard_functions.txt
stage1_2/iec.flex
stage1_2/iec.y
stage1_2/standard_function_names.c
stage3/stage3.cc
stage3/stage3.hh
stage3/visit_expression_type.cc
stage3/visit_expression_type.hh
stage4/generate_c/generate_c.cc
stage4/generate_c/generate_c.hh
stage4/generate_c/generate_c_base.cc
stage4/generate_iec/generate_iec.cc
stage4/generate_iec/generate_iec.hh
stage4/stage4.cc
stage4/stage4.hh
tests/syntax/identifier/identifier_as_variable1.test
--- a/absyntax/absyntax.def	Fri Apr 01 12:19:32 2011 +0100
+++ b/absyntax/absyntax.def	Mon Apr 04 10:42:03 2011 +0100
@@ -96,11 +96,14 @@
 SYM_REF0(eno_param_c)
 */
 
-/***************************/
-/* 2.1.6 - Pragmas */
-/***************************/
+/********************/
+/* 2.1.6 - Pragmas  */
+/********************/
+SYM_REF0(disable_code_generation_pragma_c)
+SYM_REF0(enable_code_generation_pragma_c)
 SYM_TOKEN(pragma_c)
 
+
 /***************************/
 /* B 0 - Programming Model */
 /***************************/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/create_standard_function_header.sh	Mon Apr 04 10:42:03 2011 +0100
@@ -0,0 +1,527 @@
+#!/bin/sh
+
+#/*
+# *  matiec - a compiler for the programming languages defined in IEC 61131-3
+# *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+# *
+# *  This program is free software: you can redistribute it and/or modify
+# *  it under the terms of the GNU General Public License as published by
+# *  the Free Software Foundation, either version 3 of the License, or
+# *  (at your option) any later version.
+# *
+# *  This program is distributed in the hope that it will be useful,
+# *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+# *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# *  GNU General Public License for more details.
+# *
+# *  You should have received a copy of the GNU General Public License
+# *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# *
+# *
+# * This code is made available on the understanding that it will not be
+# * used in safety-critical situations without a full and competent review.
+# */
+#
+#/*
+# * An IEC 61131-3 compiler.
+# *
+# * Based on the
+# * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
+# *
+# */
+#
+#
+#  A shell script to create the library header file containing the 
+#  standard functions defined in IEC 61131-3
+#
+
+
+create()
+{
+echo
+echo
+echo FUNCTION $1 : $3
+echo "  "VAR_INPUT   IN: $2";" END_VAR
+echo "  "VAR_OUTPUT OUT: $3";" END_VAR
+echo "  "LD TRUE
+echo END_FUNCTION
+}
+
+
+
+
+echo
+echo {disable code generation}
+echo
+echo
+
+create    REAL_TO_SINT                    REAL                SINT      
+create    REAL_TO_LINT                    REAL                LINT      
+create    REAL_TO_DINT                    REAL                DINT      
+create    REAL_TO_DATE                    REAL                DATE      
+create    REAL_TO_DWORD                   REAL                DWORD     
+create    REAL_TO_DT                      REAL                DT        
+create    REAL_TO_TOD                     REAL                TOD       
+create    REAL_TO_UDINT                   REAL                UDINT     
+create    REAL_TO_WORD                    REAL                WORD      
+create    REAL_TO_STRING                  REAL                STRING    
+create    REAL_TO_LWORD                   REAL                LWORD     
+create    REAL_TO_UINT                    REAL                UINT      
+create    REAL_TO_LREAL                   REAL                LREAL     
+create    REAL_TO_BYTE                    REAL                BYTE      
+create    REAL_TO_USINT                   REAL                USINT     
+create    REAL_TO_ULINT                   REAL                ULINT     
+create    REAL_TO_BOOL                    REAL                BOOL      
+create    REAL_TO_TIME                    REAL                TIME      
+create    REAL_TO_INT                     REAL                INT       
+create    SINT_TO_REAL                    SINT                REAL      
+create    SINT_TO_LINT                    SINT                LINT      
+create    SINT_TO_DINT                    SINT                DINT      
+create    SINT_TO_DATE                    SINT                DATE      
+create    SINT_TO_DWORD                   SINT                DWORD     
+create    SINT_TO_DT                      SINT                DT        
+create    SINT_TO_TOD                     SINT                TOD       
+create    SINT_TO_UDINT                   SINT                UDINT     
+create    SINT_TO_WORD                    SINT                WORD      
+create    SINT_TO_STRING                  SINT                STRING    
+create    SINT_TO_LWORD                   SINT                LWORD     
+create    SINT_TO_UINT                    SINT                UINT      
+create    SINT_TO_LREAL                   SINT                LREAL     
+create    SINT_TO_BYTE                    SINT                BYTE      
+create    SINT_TO_USINT                   SINT                USINT     
+create    SINT_TO_ULINT                   SINT                ULINT     
+create    SINT_TO_BOOL                    SINT                BOOL      
+create    SINT_TO_TIME                    SINT                TIME      
+create    SINT_TO_INT                     SINT                INT       
+create    LINT_TO_REAL                    LINT                REAL      
+create    LINT_TO_SINT                    LINT                SINT      
+create    LINT_TO_DINT                    LINT                DINT      
+create    LINT_TO_DATE                    LINT                DATE      
+create    LINT_TO_DWORD                   LINT                DWORD     
+create    LINT_TO_DT                      LINT                DT        
+create    LINT_TO_TOD                     LINT                TOD       
+create    LINT_TO_UDINT                   LINT                UDINT     
+create    LINT_TO_WORD                    LINT                WORD      
+create    LINT_TO_STRING                  LINT                STRING    
+create    LINT_TO_LWORD                   LINT                LWORD     
+create    LINT_TO_UINT                    LINT                UINT      
+create    LINT_TO_LREAL                   LINT                LREAL     
+create    LINT_TO_BYTE                    LINT                BYTE      
+create    LINT_TO_USINT                   LINT                USINT     
+create    LINT_TO_ULINT                   LINT                ULINT     
+create    LINT_TO_BOOL                    LINT                BOOL      
+create    LINT_TO_TIME                    LINT                TIME      
+create    LINT_TO_INT                     LINT                INT       
+create    DINT_TO_REAL                    DINT                REAL      
+create    DINT_TO_SINT                    DINT                SINT      
+create    DINT_TO_LINT                    DINT                LINT      
+create    DINT_TO_DATE                    DINT                DATE      
+create    DINT_TO_DWORD                   DINT                DWORD     
+create    DINT_TO_DT                      DINT                DT        
+create    DINT_TO_TOD                     DINT                TOD       
+create    DINT_TO_UDINT                   DINT                UDINT     
+create    DINT_TO_WORD                    DINT                WORD      
+create    DINT_TO_STRING                  DINT                STRING    
+create    DINT_TO_LWORD                   DINT                LWORD     
+create    DINT_TO_UINT                    DINT                UINT      
+create    DINT_TO_LREAL                   DINT                LREAL     
+create    DINT_TO_BYTE                    DINT                BYTE      
+create    DINT_TO_USINT                   DINT                USINT     
+create    DINT_TO_ULINT                   DINT                ULINT     
+create    DINT_TO_BOOL                    DINT                BOOL      
+create    DINT_TO_TIME                    DINT                TIME      
+create    DINT_TO_INT                     DINT                INT       
+create    DATE_TO_REAL                    DATE                REAL      
+create    DATE_TO_SINT                    DATE                SINT      
+create    DATE_TO_LINT                    DATE                LINT      
+create    DATE_TO_DINT                    DATE                DINT      
+create    DATE_TO_DWORD                   DATE                DWORD     
+create    DATE_TO_UDINT                   DATE                UDINT     
+create    DATE_TO_WORD                    DATE                WORD      
+create    DATE_TO_STRING                  DATE                STRING    
+create    DATE_TO_LWORD                   DATE                LWORD     
+create    DATE_TO_UINT                    DATE                UINT      
+create    DATE_TO_LREAL                   DATE                LREAL     
+create    DATE_TO_BYTE                    DATE                BYTE      
+create    DATE_TO_USINT                   DATE                USINT     
+create    DATE_TO_ULINT                   DATE                ULINT     
+create    DATE_TO_INT                     DATE                INT       
+create   DWORD_TO_REAL                   DWORD                REAL      
+create   DWORD_TO_SINT                   DWORD                SINT      
+create   DWORD_TO_LINT                   DWORD                LINT      
+create   DWORD_TO_DINT                   DWORD                DINT      
+create   DWORD_TO_DATE                   DWORD                DATE      
+create   DWORD_TO_DT                     DWORD                DT        
+create   DWORD_TO_TOD                    DWORD                TOD       
+create   DWORD_TO_UDINT                  DWORD                UDINT     
+create   DWORD_TO_WORD                   DWORD                WORD      
+create   DWORD_TO_STRING                 DWORD                STRING    
+create   DWORD_TO_LWORD                  DWORD                LWORD     
+create   DWORD_TO_UINT                   DWORD                UINT      
+create   DWORD_TO_LREAL                  DWORD                LREAL     
+create   DWORD_TO_BYTE                   DWORD                BYTE      
+create   DWORD_TO_USINT                  DWORD                USINT     
+create   DWORD_TO_ULINT                  DWORD                ULINT     
+create   DWORD_TO_BOOL                   DWORD                BOOL      
+create   DWORD_TO_TIME                   DWORD                TIME      
+create   DWORD_TO_INT                    DWORD                INT       
+create      DT_TO_REAL                      DT                REAL      
+create      DT_TO_SINT                      DT                SINT      
+create      DT_TO_LINT                      DT                LINT      
+create      DT_TO_DINT                      DT                DINT      
+create      DT_TO_DWORD                     DT                DWORD     
+create      DT_TO_UDINT                     DT                UDINT     
+create      DT_TO_WORD                      DT                WORD      
+create      DT_TO_STRING                    DT                STRING    
+create      DT_TO_LWORD                     DT                LWORD     
+create      DT_TO_UINT                      DT                UINT      
+create      DT_TO_LREAL                     DT                LREAL     
+create      DT_TO_BYTE                      DT                BYTE      
+create      DT_TO_USINT                     DT                USINT     
+create      DT_TO_ULINT                     DT                ULINT     
+create      DT_TO_INT                       DT                INT       
+create     TOD_TO_REAL                     TOD                REAL      
+create     TOD_TO_SINT                     TOD                SINT      
+create     TOD_TO_LINT                     TOD                LINT      
+create     TOD_TO_DINT                     TOD                DINT      
+create     TOD_TO_DWORD                    TOD                DWORD     
+create     TOD_TO_UDINT                    TOD                UDINT     
+create     TOD_TO_WORD                     TOD                WORD      
+create     TOD_TO_STRING                   TOD                STRING    
+create     TOD_TO_LWORD                    TOD                LWORD     
+create     TOD_TO_UINT                     TOD                UINT      
+create     TOD_TO_LREAL                    TOD                LREAL     
+create     TOD_TO_BYTE                     TOD                BYTE      
+create     TOD_TO_USINT                    TOD                USINT     
+create     TOD_TO_ULINT                    TOD                ULINT     
+create     TOD_TO_INT                      TOD                INT       
+create   UDINT_TO_REAL                   UDINT                REAL      
+create   UDINT_TO_SINT                   UDINT                SINT      
+create   UDINT_TO_LINT                   UDINT                LINT      
+create   UDINT_TO_DINT                   UDINT                DINT      
+create   UDINT_TO_DATE                   UDINT                DATE      
+create   UDINT_TO_DWORD                  UDINT                DWORD     
+create   UDINT_TO_DT                     UDINT                DT        
+create   UDINT_TO_TOD                    UDINT                TOD       
+create   UDINT_TO_WORD                   UDINT                WORD      
+create   UDINT_TO_STRING                 UDINT                STRING    
+create   UDINT_TO_LWORD                  UDINT                LWORD     
+create   UDINT_TO_UINT                   UDINT                UINT      
+create   UDINT_TO_LREAL                  UDINT                LREAL     
+create   UDINT_TO_BYTE                   UDINT                BYTE      
+create   UDINT_TO_USINT                  UDINT                USINT     
+create   UDINT_TO_ULINT                  UDINT                ULINT     
+create   UDINT_TO_BOOL                   UDINT                BOOL      
+create   UDINT_TO_TIME                   UDINT                TIME      
+create   UDINT_TO_INT                    UDINT                INT       
+create    WORD_TO_REAL                    WORD                REAL      
+create    WORD_TO_SINT                    WORD                SINT      
+create    WORD_TO_LINT                    WORD                LINT      
+create    WORD_TO_DINT                    WORD                DINT      
+create    WORD_TO_DATE                    WORD                DATE      
+create    WORD_TO_DWORD                   WORD                DWORD     
+create    WORD_TO_DT                      WORD                DT        
+create    WORD_TO_TOD                     WORD                TOD       
+create    WORD_TO_UDINT                   WORD                UDINT     
+create    WORD_TO_STRING                  WORD                STRING    
+create    WORD_TO_LWORD                   WORD                LWORD     
+create    WORD_TO_UINT                    WORD                UINT      
+create    WORD_TO_LREAL                   WORD                LREAL     
+create    WORD_TO_BYTE                    WORD                BYTE      
+create    WORD_TO_USINT                   WORD                USINT     
+create    WORD_TO_ULINT                   WORD                ULINT     
+create    WORD_TO_BOOL                    WORD                BOOL      
+create    WORD_TO_TIME                    WORD                TIME      
+create    WORD_TO_INT                     WORD                INT       
+create  STRING_TO_REAL                  STRING                REAL      
+create  STRING_TO_SINT                  STRING                SINT      
+create  STRING_TO_LINT                  STRING                LINT      
+create  STRING_TO_DINT                  STRING                DINT      
+create  STRING_TO_DATE                  STRING                DATE      
+create  STRING_TO_DWORD                 STRING                DWORD     
+create  STRING_TO_DT                    STRING                DT        
+create  STRING_TO_TOD                   STRING                TOD       
+create  STRING_TO_UDINT                 STRING                UDINT     
+create  STRING_TO_WORD                  STRING                WORD      
+create  STRING_TO_LWORD                 STRING                LWORD     
+create  STRING_TO_UINT                  STRING                UINT      
+create  STRING_TO_LREAL                 STRING                LREAL     
+create  STRING_TO_BYTE                  STRING                BYTE      
+create  STRING_TO_USINT                 STRING                USINT     
+create  STRING_TO_ULINT                 STRING                ULINT     
+create  STRING_TO_BOOL                  STRING                BOOL      
+create  STRING_TO_TIME                  STRING                TIME      
+create  STRING_TO_INT                   STRING                INT       
+create   LWORD_TO_REAL                   LWORD                REAL      
+create   LWORD_TO_SINT                   LWORD                SINT      
+create   LWORD_TO_LINT                   LWORD                LINT      
+create   LWORD_TO_DINT                   LWORD                DINT      
+create   LWORD_TO_DATE                   LWORD                DATE      
+create   LWORD_TO_DWORD                  LWORD                DWORD     
+create   LWORD_TO_DT                     LWORD                DT        
+create   LWORD_TO_TOD                    LWORD                TOD       
+create   LWORD_TO_UDINT                  LWORD                UDINT     
+create   LWORD_TO_WORD                   LWORD                WORD      
+create   LWORD_TO_STRING                 LWORD                STRING    
+create   LWORD_TO_UINT                   LWORD                UINT      
+create   LWORD_TO_LREAL                  LWORD                LREAL     
+create   LWORD_TO_BYTE                   LWORD                BYTE      
+create   LWORD_TO_USINT                  LWORD                USINT     
+create   LWORD_TO_ULINT                  LWORD                ULINT     
+create   LWORD_TO_BOOL                   LWORD                BOOL      
+create   LWORD_TO_TIME                   LWORD                TIME      
+create   LWORD_TO_INT                    LWORD                INT       
+create    UINT_TO_REAL                    UINT                REAL      
+create    UINT_TO_SINT                    UINT                SINT      
+create    UINT_TO_LINT                    UINT                LINT      
+create    UINT_TO_DINT                    UINT                DINT      
+create    UINT_TO_DATE                    UINT                DATE      
+create    UINT_TO_DWORD                   UINT                DWORD     
+create    UINT_TO_DT                      UINT                DT        
+create    UINT_TO_TOD                     UINT                TOD       
+create    UINT_TO_UDINT                   UINT                UDINT     
+create    UINT_TO_WORD                    UINT                WORD      
+create    UINT_TO_STRING                  UINT                STRING    
+create    UINT_TO_LWORD                   UINT                LWORD     
+create    UINT_TO_LREAL                   UINT                LREAL     
+create    UINT_TO_BYTE                    UINT                BYTE      
+create    UINT_TO_USINT                   UINT                USINT     
+create    UINT_TO_ULINT                   UINT                ULINT     
+create    UINT_TO_BOOL                    UINT                BOOL      
+create    UINT_TO_TIME                    UINT                TIME      
+create    UINT_TO_INT                     UINT                INT       
+create   LREAL_TO_REAL                   LREAL                REAL      
+create   LREAL_TO_SINT                   LREAL                SINT      
+create   LREAL_TO_LINT                   LREAL                LINT      
+create   LREAL_TO_DINT                   LREAL                DINT      
+create   LREAL_TO_DATE                   LREAL                DATE      
+create   LREAL_TO_DWORD                  LREAL                DWORD     
+create   LREAL_TO_DT                     LREAL                DT        
+create   LREAL_TO_TOD                    LREAL                TOD       
+create   LREAL_TO_UDINT                  LREAL                UDINT     
+create   LREAL_TO_WORD                   LREAL                WORD      
+create   LREAL_TO_STRING                 LREAL                STRING    
+create   LREAL_TO_LWORD                  LREAL                LWORD     
+create   LREAL_TO_UINT                   LREAL                UINT      
+create   LREAL_TO_BYTE                   LREAL                BYTE      
+create   LREAL_TO_USINT                  LREAL                USINT     
+create   LREAL_TO_ULINT                  LREAL                ULINT     
+create   LREAL_TO_BOOL                   LREAL                BOOL      
+create   LREAL_TO_TIME                   LREAL                TIME      
+create   LREAL_TO_INT                    LREAL                INT       
+create    BYTE_TO_REAL                    BYTE                REAL      
+create    BYTE_TO_SINT                    BYTE                SINT      
+create    BYTE_TO_LINT                    BYTE                LINT      
+create    BYTE_TO_DINT                    BYTE                DINT      
+create    BYTE_TO_DATE                    BYTE                DATE      
+create    BYTE_TO_DWORD                   BYTE                DWORD     
+create    BYTE_TO_DT                      BYTE                DT        
+create    BYTE_TO_TOD                     BYTE                TOD       
+create    BYTE_TO_UDINT                   BYTE                UDINT     
+create    BYTE_TO_WORD                    BYTE                WORD      
+create    BYTE_TO_STRING                  BYTE                STRING    
+create    BYTE_TO_LWORD                   BYTE                LWORD     
+create    BYTE_TO_UINT                    BYTE                UINT      
+create    BYTE_TO_LREAL                   BYTE                LREAL     
+create    BYTE_TO_USINT                   BYTE                USINT     
+create    BYTE_TO_ULINT                   BYTE                ULINT     
+create    BYTE_TO_BOOL                    BYTE                BOOL      
+create    BYTE_TO_TIME                    BYTE                TIME      
+create    BYTE_TO_INT                     BYTE                INT       
+create   USINT_TO_REAL                   USINT                REAL      
+create   USINT_TO_SINT                   USINT                SINT      
+create   USINT_TO_LINT                   USINT                LINT      
+create   USINT_TO_DINT                   USINT                DINT      
+create   USINT_TO_DATE                   USINT                DATE      
+create   USINT_TO_DWORD                  USINT                DWORD     
+create   USINT_TO_DT                     USINT                DT        
+create   USINT_TO_TOD                    USINT                TOD       
+create   USINT_TO_UDINT                  USINT                UDINT     
+create   USINT_TO_WORD                   USINT                WORD      
+create   USINT_TO_STRING                 USINT                STRING    
+create   USINT_TO_LWORD                  USINT                LWORD     
+create   USINT_TO_UINT                   USINT                UINT      
+create   USINT_TO_LREAL                  USINT                LREAL     
+create   USINT_TO_BYTE                   USINT                BYTE      
+create   USINT_TO_ULINT                  USINT                ULINT     
+create   USINT_TO_BOOL                   USINT                BOOL      
+create   USINT_TO_TIME                   USINT                TIME      
+create   USINT_TO_INT                    USINT                INT       
+create   ULINT_TO_REAL                   ULINT                REAL      
+create   ULINT_TO_SINT                   ULINT                SINT      
+create   ULINT_TO_LINT                   ULINT                LINT      
+create   ULINT_TO_DINT                   ULINT                DINT      
+create   ULINT_TO_DATE                   ULINT                DATE      
+create   ULINT_TO_DWORD                  ULINT                DWORD     
+create   ULINT_TO_DT                     ULINT                DT        
+create   ULINT_TO_TOD                    ULINT                TOD       
+create   ULINT_TO_UDINT                  ULINT                UDINT     
+create   ULINT_TO_WORD                   ULINT                WORD      
+create   ULINT_TO_STRING                 ULINT                STRING    
+create   ULINT_TO_LWORD                  ULINT                LWORD     
+create   ULINT_TO_UINT                   ULINT                UINT      
+create   ULINT_TO_LREAL                  ULINT                LREAL     
+create   ULINT_TO_BYTE                   ULINT                BYTE      
+create   ULINT_TO_USINT                  ULINT                USINT     
+create   ULINT_TO_BOOL                   ULINT                BOOL      
+create   ULINT_TO_TIME                   ULINT                TIME      
+create   ULINT_TO_INT                    ULINT                INT       
+create    BOOL_TO_REAL                    BOOL                REAL      
+create    BOOL_TO_SINT                    BOOL                SINT      
+create    BOOL_TO_LINT                    BOOL                LINT      
+create    BOOL_TO_DINT                    BOOL                DINT      
+create    BOOL_TO_DATE                    BOOL                DATE      
+create    BOOL_TO_DWORD                   BOOL                DWORD     
+create    BOOL_TO_DT                      BOOL                DT        
+create    BOOL_TO_TOD                     BOOL                TOD       
+create    BOOL_TO_UDINT                   BOOL                UDINT     
+create    BOOL_TO_WORD                    BOOL                WORD      
+create    BOOL_TO_STRING                  BOOL                STRING    
+create    BOOL_TO_LWORD                   BOOL                LWORD     
+create    BOOL_TO_UINT                    BOOL                UINT      
+create    BOOL_TO_LREAL                   BOOL                LREAL     
+create    BOOL_TO_BYTE                    BOOL                BYTE      
+create    BOOL_TO_USINT                   BOOL                USINT     
+create    BOOL_TO_ULINT                   BOOL                ULINT     
+create    BOOL_TO_TIME                    BOOL                TIME      
+create    BOOL_TO_INT                     BOOL                INT       
+create    TIME_TO_REAL                    TIME                REAL      
+create    TIME_TO_SINT                    TIME                SINT      
+create    TIME_TO_LINT                    TIME                LINT      
+create    TIME_TO_DINT                    TIME                DINT      
+create    TIME_TO_DWORD                   TIME                DWORD     
+create    TIME_TO_UDINT                   TIME                UDINT     
+create    TIME_TO_WORD                    TIME                WORD      
+create    TIME_TO_STRING                  TIME                STRING    
+create    TIME_TO_LWORD                   TIME                LWORD     
+create    TIME_TO_UINT                    TIME                UINT      
+create    TIME_TO_LREAL                   TIME                LREAL     
+create    TIME_TO_BYTE                    TIME                BYTE      
+create    TIME_TO_USINT                   TIME                USINT     
+create    TIME_TO_ULINT                   TIME                ULINT     
+create    TIME_TO_INT                     TIME                INT       
+create     INT_TO_REAL                     INT                REAL      
+create     INT_TO_SINT                     INT                SINT      
+create     INT_TO_LINT                     INT                LINT      
+create     INT_TO_DINT                     INT                DINT      
+create     INT_TO_DATE                     INT                DATE      
+create     INT_TO_DWORD                    INT                DWORD     
+create     INT_TO_DT                       INT                DT        
+create     INT_TO_TOD                      INT                TOD       
+create     INT_TO_UDINT                    INT                UDINT     
+create     INT_TO_WORD                     INT                WORD      
+create     INT_TO_STRING                   INT                STRING    
+create     INT_TO_LWORD                    INT                LWORD     
+create     INT_TO_UINT                     INT                UINT      
+create     INT_TO_LREAL                    INT                LREAL     
+create     INT_TO_BYTE                     INT                BYTE      
+create     INT_TO_USINT                    INT                USINT     
+create     INT_TO_ULINT                    INT                ULINT     
+create     INT_TO_BOOL                     INT                BOOL      
+create     INT_TO_TIME                     INT                TIME      
+
+create DATE_AND_TIME_TO_TIME_OF_DAY     DATE_AND_TIME       TIME_OF_DAY  
+create DATE_AND_TIME_TO_DATE            DATE_AND_TIME       DATE         
+
+echo
+echo
+echo  "(*   *BCD_TO_**   and   **_TO_BCD*     are not yet supported  *)"
+echo  "(*  We comment them out for now...                            *)"
+echo  "(*"
+create   UDINT_TO_BCD_BYTE               UDINT                BYTE  
+create   UDINT_TO_BCD_WORD               UDINT                WORD  
+create   UDINT_TO_BCD_DWORD              UDINT                DWORD 
+create   UDINT_TO_BCD_LWORD              UDINT                LWORD 
+create    UINT_TO_BCD_BYTE                UINT                BYTE    
+create    UINT_TO_BCD_WORD                UINT                WORD    
+create    UINT_TO_BCD_DWORD               UINT                DWORD   
+create    UINT_TO_BCD_LWORD               UINT                LWORD   
+create   USINT_TO_BCD_BYTE               USINT                BYTE        
+create   USINT_TO_BCD_WORD               USINT                WORD        
+create   USINT_TO_BCD_DWORD              USINT                DWORD       
+create   USINT_TO_BCD_LWORD              USINT                LWORD       
+create   ULINT_TO_BCD_BYTE               ULINT                BYTE        
+create   ULINT_TO_BCD_WORD               ULINT                WORD        
+create   ULINT_TO_BCD_DWORD              ULINT                DWORD       
+create   ULINT_TO_BCD_LWORD              ULINT                LWORD       
+
+create   BYTE_BCD_TO_UDINT               BYTE                 UDINT                
+create   WORD_BCD_TO_UDINT               WORD                 UDINT                
+create  DWORD_BCD_TO_UDINT               DWORD                UDINT                
+create  LWORD_BCD_TO_UDINT               LWORD                UDINT                
+create   BYTE_BCD_TO_UINT                BYTE                 UINT                   
+create   WORD_BCD_TO_UINT                WORD                 UINT                   
+create  DWORD_BCD_TO_UINT                DWORD                UINT                   
+create  LWORD_BCD_TO_UINT                LWORD                UINT                   
+create   BYTE_BCD_TO_USINT               BYTE                 USINT                      
+create   WORD_BCD_TO_USINT               WORD                 USINT                      
+create  DWORD_BCD_TO_USINT               DWORD                USINT                      
+create  LWORD_BCD_TO_USINT               LWORD                USINT                      
+create   BYTE_BCD_TO_ULINT               BYTE                 ULINT                      
+create   WORD_BCD_TO_ULINT               WORD                 ULINT                      
+create  DWORD_BCD_TO_ULINT               DWORD                ULINT                      
+create  LWORD_BCD_TO_ULINT               LWORD                ULINT                      
+echo  "*)"
+
+
+echo
+echo {disable code generation}
+
+exit 0
+
+    ABS             
+    SQRT
+    LN
+    LOG
+    EXP
+    SIN
+    COS
+    TAN
+    ASIN
+    ACOS
+    ATAN
+    ADD
+    MUL
+    SUB
+    DIV
+    MOD
+    EXPT
+    MOVE
+    SHL
+    SHR
+    ROR
+    ROL
+    AND
+    OR
+    XOR
+    NOT
+    SEL
+    MAX
+    MIN
+    LIMIT
+    MUX
+    GT
+    GE
+    EQ
+    LT
+    LE
+    NE
+    LEN
+    LEFT
+    RIGHT
+    MID
+    CONCAT
+    INSERT
+    DELETE
+    REPLACE
+    FIND
+    
+    TRUNC
+    
+    
+    
+    
+    
+    
+    
+    
--- a/lib/ieclib.txt	Fri Apr 01 12:19:32 2011 +0100
+++ b/lib/ieclib.txt	Mon Apr 04 10:42:03 2011 +0100
@@ -1,32 +1,43 @@
 (*
- * (c) 2003 Mario de Sousa
+ *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
- * Offered to the public under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
+ *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
  *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
- * Public License for more details.
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
  *
  * This code is made available on the understanding that it will not be
  * used in safety-critical situations without a full and competent review.
  *)
 
 (*
- * An IEC 61131-3 IL and ST compiler.
+ * An IEC 61131-3 compiler.
  *
  * Based on the
  * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
  *
  *)
 
-(*
- * This is the library conatining the function blocks defined in the standard.
+(*******************************************************************************************************
+ * This is the library conatining the standard functions and function blocks defined in the standard.  *
+ *******************************************************************************************************
  *)
 
+(* The standard functions *)
+{#include "standard_functions.txt" }
 
+(* The standard function blocks *)
 {#include "edge_detection.txt" }
 {#include "bistable.txt" }
 {#include "counter.txt" }
@@ -36,4 +47,6 @@
 {#include "integral_st.txt" }
 {#include "pid_st.txt" }
 {#include "ramp_st.txt" }
+
+(* Some usefull non-standard function blocks *)
 {#include "sema.txt" }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/standard_functions.txt	Mon Apr 04 10:42:03 2011 +0100
@@ -0,0 +1,2798 @@
+
+{disable code generation}
+
+
+
+
+FUNCTION REAL_TO_SINT : SINT
+  VAR_INPUT IN: REAL; END_VAR
+  VAR_OUTPUT OUT: SINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION REAL_TO_LINT : LINT
+  VAR_INPUT IN: REAL; END_VAR
+  VAR_OUTPUT OUT: LINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION REAL_TO_DINT : DINT
+  VAR_INPUT IN: REAL; END_VAR
+  VAR_OUTPUT OUT: DINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION REAL_TO_DATE : DATE
+  VAR_INPUT IN: REAL; END_VAR
+  VAR_OUTPUT OUT: DATE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION REAL_TO_DWORD : DWORD
+  VAR_INPUT IN: REAL; END_VAR
+  VAR_OUTPUT OUT: DWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION REAL_TO_DT : DT
+  VAR_INPUT IN: REAL; END_VAR
+  VAR_OUTPUT OUT: DT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION REAL_TO_TOD : TOD
+  VAR_INPUT IN: REAL; END_VAR
+  VAR_OUTPUT OUT: TOD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION REAL_TO_UDINT : UDINT
+  VAR_INPUT IN: REAL; END_VAR
+  VAR_OUTPUT OUT: UDINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION REAL_TO_WORD : WORD
+  VAR_INPUT IN: REAL; END_VAR
+  VAR_OUTPUT OUT: WORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION REAL_TO_STRING : STRING
+  VAR_INPUT IN: REAL; END_VAR
+  VAR_OUTPUT OUT: STRING; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION REAL_TO_LWORD : LWORD
+  VAR_INPUT IN: REAL; END_VAR
+  VAR_OUTPUT OUT: LWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION REAL_TO_UINT : UINT
+  VAR_INPUT IN: REAL; END_VAR
+  VAR_OUTPUT OUT: UINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION REAL_TO_LREAL : LREAL
+  VAR_INPUT IN: REAL; END_VAR
+  VAR_OUTPUT OUT: LREAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION REAL_TO_BYTE : BYTE
+  VAR_INPUT IN: REAL; END_VAR
+  VAR_OUTPUT OUT: BYTE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION REAL_TO_USINT : USINT
+  VAR_INPUT IN: REAL; END_VAR
+  VAR_OUTPUT OUT: USINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION REAL_TO_ULINT : ULINT
+  VAR_INPUT IN: REAL; END_VAR
+  VAR_OUTPUT OUT: ULINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION REAL_TO_BOOL : BOOL
+  VAR_INPUT IN: REAL; END_VAR
+  VAR_OUTPUT OUT: BOOL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION REAL_TO_TIME : TIME
+  VAR_INPUT IN: REAL; END_VAR
+  VAR_OUTPUT OUT: TIME; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION REAL_TO_INT : INT
+  VAR_INPUT IN: REAL; END_VAR
+  VAR_OUTPUT OUT: INT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION SINT_TO_REAL : REAL
+  VAR_INPUT IN: SINT; END_VAR
+  VAR_OUTPUT OUT: REAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION SINT_TO_LINT : LINT
+  VAR_INPUT IN: SINT; END_VAR
+  VAR_OUTPUT OUT: LINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION SINT_TO_DINT : DINT
+  VAR_INPUT IN: SINT; END_VAR
+  VAR_OUTPUT OUT: DINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION SINT_TO_DATE : DATE
+  VAR_INPUT IN: SINT; END_VAR
+  VAR_OUTPUT OUT: DATE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION SINT_TO_DWORD : DWORD
+  VAR_INPUT IN: SINT; END_VAR
+  VAR_OUTPUT OUT: DWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION SINT_TO_DT : DT
+  VAR_INPUT IN: SINT; END_VAR
+  VAR_OUTPUT OUT: DT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION SINT_TO_TOD : TOD
+  VAR_INPUT IN: SINT; END_VAR
+  VAR_OUTPUT OUT: TOD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION SINT_TO_UDINT : UDINT
+  VAR_INPUT IN: SINT; END_VAR
+  VAR_OUTPUT OUT: UDINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION SINT_TO_WORD : WORD
+  VAR_INPUT IN: SINT; END_VAR
+  VAR_OUTPUT OUT: WORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION SINT_TO_STRING : STRING
+  VAR_INPUT IN: SINT; END_VAR
+  VAR_OUTPUT OUT: STRING; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION SINT_TO_LWORD : LWORD
+  VAR_INPUT IN: SINT; END_VAR
+  VAR_OUTPUT OUT: LWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION SINT_TO_UINT : UINT
+  VAR_INPUT IN: SINT; END_VAR
+  VAR_OUTPUT OUT: UINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION SINT_TO_LREAL : LREAL
+  VAR_INPUT IN: SINT; END_VAR
+  VAR_OUTPUT OUT: LREAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION SINT_TO_BYTE : BYTE
+  VAR_INPUT IN: SINT; END_VAR
+  VAR_OUTPUT OUT: BYTE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION SINT_TO_USINT : USINT
+  VAR_INPUT IN: SINT; END_VAR
+  VAR_OUTPUT OUT: USINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION SINT_TO_ULINT : ULINT
+  VAR_INPUT IN: SINT; END_VAR
+  VAR_OUTPUT OUT: ULINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION SINT_TO_BOOL : BOOL
+  VAR_INPUT IN: SINT; END_VAR
+  VAR_OUTPUT OUT: BOOL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION SINT_TO_TIME : TIME
+  VAR_INPUT IN: SINT; END_VAR
+  VAR_OUTPUT OUT: TIME; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION SINT_TO_INT : INT
+  VAR_INPUT IN: SINT; END_VAR
+  VAR_OUTPUT OUT: INT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LINT_TO_REAL : REAL
+  VAR_INPUT IN: LINT; END_VAR
+  VAR_OUTPUT OUT: REAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LINT_TO_SINT : SINT
+  VAR_INPUT IN: LINT; END_VAR
+  VAR_OUTPUT OUT: SINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LINT_TO_DINT : DINT
+  VAR_INPUT IN: LINT; END_VAR
+  VAR_OUTPUT OUT: DINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LINT_TO_DATE : DATE
+  VAR_INPUT IN: LINT; END_VAR
+  VAR_OUTPUT OUT: DATE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LINT_TO_DWORD : DWORD
+  VAR_INPUT IN: LINT; END_VAR
+  VAR_OUTPUT OUT: DWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LINT_TO_DT : DT
+  VAR_INPUT IN: LINT; END_VAR
+  VAR_OUTPUT OUT: DT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LINT_TO_TOD : TOD
+  VAR_INPUT IN: LINT; END_VAR
+  VAR_OUTPUT OUT: TOD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LINT_TO_UDINT : UDINT
+  VAR_INPUT IN: LINT; END_VAR
+  VAR_OUTPUT OUT: UDINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LINT_TO_WORD : WORD
+  VAR_INPUT IN: LINT; END_VAR
+  VAR_OUTPUT OUT: WORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LINT_TO_STRING : STRING
+  VAR_INPUT IN: LINT; END_VAR
+  VAR_OUTPUT OUT: STRING; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LINT_TO_LWORD : LWORD
+  VAR_INPUT IN: LINT; END_VAR
+  VAR_OUTPUT OUT: LWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LINT_TO_UINT : UINT
+  VAR_INPUT IN: LINT; END_VAR
+  VAR_OUTPUT OUT: UINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LINT_TO_LREAL : LREAL
+  VAR_INPUT IN: LINT; END_VAR
+  VAR_OUTPUT OUT: LREAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LINT_TO_BYTE : BYTE
+  VAR_INPUT IN: LINT; END_VAR
+  VAR_OUTPUT OUT: BYTE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LINT_TO_USINT : USINT
+  VAR_INPUT IN: LINT; END_VAR
+  VAR_OUTPUT OUT: USINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LINT_TO_ULINT : ULINT
+  VAR_INPUT IN: LINT; END_VAR
+  VAR_OUTPUT OUT: ULINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LINT_TO_BOOL : BOOL
+  VAR_INPUT IN: LINT; END_VAR
+  VAR_OUTPUT OUT: BOOL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LINT_TO_TIME : TIME
+  VAR_INPUT IN: LINT; END_VAR
+  VAR_OUTPUT OUT: TIME; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LINT_TO_INT : INT
+  VAR_INPUT IN: LINT; END_VAR
+  VAR_OUTPUT OUT: INT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DINT_TO_REAL : REAL
+  VAR_INPUT IN: DINT; END_VAR
+  VAR_OUTPUT OUT: REAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DINT_TO_SINT : SINT
+  VAR_INPUT IN: DINT; END_VAR
+  VAR_OUTPUT OUT: SINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DINT_TO_LINT : LINT
+  VAR_INPUT IN: DINT; END_VAR
+  VAR_OUTPUT OUT: LINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DINT_TO_DATE : DATE
+  VAR_INPUT IN: DINT; END_VAR
+  VAR_OUTPUT OUT: DATE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DINT_TO_DWORD : DWORD
+  VAR_INPUT IN: DINT; END_VAR
+  VAR_OUTPUT OUT: DWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DINT_TO_DT : DT
+  VAR_INPUT IN: DINT; END_VAR
+  VAR_OUTPUT OUT: DT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DINT_TO_TOD : TOD
+  VAR_INPUT IN: DINT; END_VAR
+  VAR_OUTPUT OUT: TOD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DINT_TO_UDINT : UDINT
+  VAR_INPUT IN: DINT; END_VAR
+  VAR_OUTPUT OUT: UDINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DINT_TO_WORD : WORD
+  VAR_INPUT IN: DINT; END_VAR
+  VAR_OUTPUT OUT: WORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DINT_TO_STRING : STRING
+  VAR_INPUT IN: DINT; END_VAR
+  VAR_OUTPUT OUT: STRING; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DINT_TO_LWORD : LWORD
+  VAR_INPUT IN: DINT; END_VAR
+  VAR_OUTPUT OUT: LWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DINT_TO_UINT : UINT
+  VAR_INPUT IN: DINT; END_VAR
+  VAR_OUTPUT OUT: UINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DINT_TO_LREAL : LREAL
+  VAR_INPUT IN: DINT; END_VAR
+  VAR_OUTPUT OUT: LREAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DINT_TO_BYTE : BYTE
+  VAR_INPUT IN: DINT; END_VAR
+  VAR_OUTPUT OUT: BYTE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DINT_TO_USINT : USINT
+  VAR_INPUT IN: DINT; END_VAR
+  VAR_OUTPUT OUT: USINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DINT_TO_ULINT : ULINT
+  VAR_INPUT IN: DINT; END_VAR
+  VAR_OUTPUT OUT: ULINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DINT_TO_BOOL : BOOL
+  VAR_INPUT IN: DINT; END_VAR
+  VAR_OUTPUT OUT: BOOL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DINT_TO_TIME : TIME
+  VAR_INPUT IN: DINT; END_VAR
+  VAR_OUTPUT OUT: TIME; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DINT_TO_INT : INT
+  VAR_INPUT IN: DINT; END_VAR
+  VAR_OUTPUT OUT: INT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DATE_TO_REAL : REAL
+  VAR_INPUT IN: DATE; END_VAR
+  VAR_OUTPUT OUT: REAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DATE_TO_SINT : SINT
+  VAR_INPUT IN: DATE; END_VAR
+  VAR_OUTPUT OUT: SINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DATE_TO_LINT : LINT
+  VAR_INPUT IN: DATE; END_VAR
+  VAR_OUTPUT OUT: LINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DATE_TO_DINT : DINT
+  VAR_INPUT IN: DATE; END_VAR
+  VAR_OUTPUT OUT: DINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DATE_TO_DWORD : DWORD
+  VAR_INPUT IN: DATE; END_VAR
+  VAR_OUTPUT OUT: DWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DATE_TO_UDINT : UDINT
+  VAR_INPUT IN: DATE; END_VAR
+  VAR_OUTPUT OUT: UDINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DATE_TO_WORD : WORD
+  VAR_INPUT IN: DATE; END_VAR
+  VAR_OUTPUT OUT: WORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DATE_TO_STRING : STRING
+  VAR_INPUT IN: DATE; END_VAR
+  VAR_OUTPUT OUT: STRING; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DATE_TO_LWORD : LWORD
+  VAR_INPUT IN: DATE; END_VAR
+  VAR_OUTPUT OUT: LWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DATE_TO_UINT : UINT
+  VAR_INPUT IN: DATE; END_VAR
+  VAR_OUTPUT OUT: UINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DATE_TO_LREAL : LREAL
+  VAR_INPUT IN: DATE; END_VAR
+  VAR_OUTPUT OUT: LREAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DATE_TO_BYTE : BYTE
+  VAR_INPUT IN: DATE; END_VAR
+  VAR_OUTPUT OUT: BYTE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DATE_TO_USINT : USINT
+  VAR_INPUT IN: DATE; END_VAR
+  VAR_OUTPUT OUT: USINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DATE_TO_ULINT : ULINT
+  VAR_INPUT IN: DATE; END_VAR
+  VAR_OUTPUT OUT: ULINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DATE_TO_INT : INT
+  VAR_INPUT IN: DATE; END_VAR
+  VAR_OUTPUT OUT: INT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DWORD_TO_REAL : REAL
+  VAR_INPUT IN: DWORD; END_VAR
+  VAR_OUTPUT OUT: REAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DWORD_TO_SINT : SINT
+  VAR_INPUT IN: DWORD; END_VAR
+  VAR_OUTPUT OUT: SINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DWORD_TO_LINT : LINT
+  VAR_INPUT IN: DWORD; END_VAR
+  VAR_OUTPUT OUT: LINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DWORD_TO_DINT : DINT
+  VAR_INPUT IN: DWORD; END_VAR
+  VAR_OUTPUT OUT: DINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DWORD_TO_DATE : DATE
+  VAR_INPUT IN: DWORD; END_VAR
+  VAR_OUTPUT OUT: DATE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DWORD_TO_DT : DT
+  VAR_INPUT IN: DWORD; END_VAR
+  VAR_OUTPUT OUT: DT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DWORD_TO_TOD : TOD
+  VAR_INPUT IN: DWORD; END_VAR
+  VAR_OUTPUT OUT: TOD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DWORD_TO_UDINT : UDINT
+  VAR_INPUT IN: DWORD; END_VAR
+  VAR_OUTPUT OUT: UDINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DWORD_TO_WORD : WORD
+  VAR_INPUT IN: DWORD; END_VAR
+  VAR_OUTPUT OUT: WORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DWORD_TO_STRING : STRING
+  VAR_INPUT IN: DWORD; END_VAR
+  VAR_OUTPUT OUT: STRING; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DWORD_TO_LWORD : LWORD
+  VAR_INPUT IN: DWORD; END_VAR
+  VAR_OUTPUT OUT: LWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DWORD_TO_UINT : UINT
+  VAR_INPUT IN: DWORD; END_VAR
+  VAR_OUTPUT OUT: UINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DWORD_TO_LREAL : LREAL
+  VAR_INPUT IN: DWORD; END_VAR
+  VAR_OUTPUT OUT: LREAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DWORD_TO_BYTE : BYTE
+  VAR_INPUT IN: DWORD; END_VAR
+  VAR_OUTPUT OUT: BYTE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DWORD_TO_USINT : USINT
+  VAR_INPUT IN: DWORD; END_VAR
+  VAR_OUTPUT OUT: USINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DWORD_TO_ULINT : ULINT
+  VAR_INPUT IN: DWORD; END_VAR
+  VAR_OUTPUT OUT: ULINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DWORD_TO_BOOL : BOOL
+  VAR_INPUT IN: DWORD; END_VAR
+  VAR_OUTPUT OUT: BOOL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DWORD_TO_TIME : TIME
+  VAR_INPUT IN: DWORD; END_VAR
+  VAR_OUTPUT OUT: TIME; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DWORD_TO_INT : INT
+  VAR_INPUT IN: DWORD; END_VAR
+  VAR_OUTPUT OUT: INT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DT_TO_REAL : REAL
+  VAR_INPUT IN: DT; END_VAR
+  VAR_OUTPUT OUT: REAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DT_TO_SINT : SINT
+  VAR_INPUT IN: DT; END_VAR
+  VAR_OUTPUT OUT: SINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DT_TO_LINT : LINT
+  VAR_INPUT IN: DT; END_VAR
+  VAR_OUTPUT OUT: LINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DT_TO_DINT : DINT
+  VAR_INPUT IN: DT; END_VAR
+  VAR_OUTPUT OUT: DINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DT_TO_DWORD : DWORD
+  VAR_INPUT IN: DT; END_VAR
+  VAR_OUTPUT OUT: DWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DT_TO_UDINT : UDINT
+  VAR_INPUT IN: DT; END_VAR
+  VAR_OUTPUT OUT: UDINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DT_TO_WORD : WORD
+  VAR_INPUT IN: DT; END_VAR
+  VAR_OUTPUT OUT: WORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DT_TO_STRING : STRING
+  VAR_INPUT IN: DT; END_VAR
+  VAR_OUTPUT OUT: STRING; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DT_TO_LWORD : LWORD
+  VAR_INPUT IN: DT; END_VAR
+  VAR_OUTPUT OUT: LWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DT_TO_UINT : UINT
+  VAR_INPUT IN: DT; END_VAR
+  VAR_OUTPUT OUT: UINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DT_TO_LREAL : LREAL
+  VAR_INPUT IN: DT; END_VAR
+  VAR_OUTPUT OUT: LREAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DT_TO_BYTE : BYTE
+  VAR_INPUT IN: DT; END_VAR
+  VAR_OUTPUT OUT: BYTE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DT_TO_USINT : USINT
+  VAR_INPUT IN: DT; END_VAR
+  VAR_OUTPUT OUT: USINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DT_TO_ULINT : ULINT
+  VAR_INPUT IN: DT; END_VAR
+  VAR_OUTPUT OUT: ULINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DT_TO_INT : INT
+  VAR_INPUT IN: DT; END_VAR
+  VAR_OUTPUT OUT: INT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION TOD_TO_REAL : REAL
+  VAR_INPUT IN: TOD; END_VAR
+  VAR_OUTPUT OUT: REAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION TOD_TO_SINT : SINT
+  VAR_INPUT IN: TOD; END_VAR
+  VAR_OUTPUT OUT: SINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION TOD_TO_LINT : LINT
+  VAR_INPUT IN: TOD; END_VAR
+  VAR_OUTPUT OUT: LINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION TOD_TO_DINT : DINT
+  VAR_INPUT IN: TOD; END_VAR
+  VAR_OUTPUT OUT: DINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION TOD_TO_DWORD : DWORD
+  VAR_INPUT IN: TOD; END_VAR
+  VAR_OUTPUT OUT: DWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION TOD_TO_UDINT : UDINT
+  VAR_INPUT IN: TOD; END_VAR
+  VAR_OUTPUT OUT: UDINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION TOD_TO_WORD : WORD
+  VAR_INPUT IN: TOD; END_VAR
+  VAR_OUTPUT OUT: WORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION TOD_TO_STRING : STRING
+  VAR_INPUT IN: TOD; END_VAR
+  VAR_OUTPUT OUT: STRING; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION TOD_TO_LWORD : LWORD
+  VAR_INPUT IN: TOD; END_VAR
+  VAR_OUTPUT OUT: LWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION TOD_TO_UINT : UINT
+  VAR_INPUT IN: TOD; END_VAR
+  VAR_OUTPUT OUT: UINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION TOD_TO_LREAL : LREAL
+  VAR_INPUT IN: TOD; END_VAR
+  VAR_OUTPUT OUT: LREAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION TOD_TO_BYTE : BYTE
+  VAR_INPUT IN: TOD; END_VAR
+  VAR_OUTPUT OUT: BYTE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION TOD_TO_USINT : USINT
+  VAR_INPUT IN: TOD; END_VAR
+  VAR_OUTPUT OUT: USINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION TOD_TO_ULINT : ULINT
+  VAR_INPUT IN: TOD; END_VAR
+  VAR_OUTPUT OUT: ULINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION TOD_TO_INT : INT
+  VAR_INPUT IN: TOD; END_VAR
+  VAR_OUTPUT OUT: INT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UDINT_TO_REAL : REAL
+  VAR_INPUT IN: UDINT; END_VAR
+  VAR_OUTPUT OUT: REAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UDINT_TO_SINT : SINT
+  VAR_INPUT IN: UDINT; END_VAR
+  VAR_OUTPUT OUT: SINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UDINT_TO_LINT : LINT
+  VAR_INPUT IN: UDINT; END_VAR
+  VAR_OUTPUT OUT: LINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UDINT_TO_DINT : DINT
+  VAR_INPUT IN: UDINT; END_VAR
+  VAR_OUTPUT OUT: DINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UDINT_TO_DATE : DATE
+  VAR_INPUT IN: UDINT; END_VAR
+  VAR_OUTPUT OUT: DATE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UDINT_TO_DWORD : DWORD
+  VAR_INPUT IN: UDINT; END_VAR
+  VAR_OUTPUT OUT: DWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UDINT_TO_DT : DT
+  VAR_INPUT IN: UDINT; END_VAR
+  VAR_OUTPUT OUT: DT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UDINT_TO_TOD : TOD
+  VAR_INPUT IN: UDINT; END_VAR
+  VAR_OUTPUT OUT: TOD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UDINT_TO_WORD : WORD
+  VAR_INPUT IN: UDINT; END_VAR
+  VAR_OUTPUT OUT: WORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UDINT_TO_STRING : STRING
+  VAR_INPUT IN: UDINT; END_VAR
+  VAR_OUTPUT OUT: STRING; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UDINT_TO_LWORD : LWORD
+  VAR_INPUT IN: UDINT; END_VAR
+  VAR_OUTPUT OUT: LWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UDINT_TO_UINT : UINT
+  VAR_INPUT IN: UDINT; END_VAR
+  VAR_OUTPUT OUT: UINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UDINT_TO_LREAL : LREAL
+  VAR_INPUT IN: UDINT; END_VAR
+  VAR_OUTPUT OUT: LREAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UDINT_TO_BYTE : BYTE
+  VAR_INPUT IN: UDINT; END_VAR
+  VAR_OUTPUT OUT: BYTE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UDINT_TO_USINT : USINT
+  VAR_INPUT IN: UDINT; END_VAR
+  VAR_OUTPUT OUT: USINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UDINT_TO_ULINT : ULINT
+  VAR_INPUT IN: UDINT; END_VAR
+  VAR_OUTPUT OUT: ULINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UDINT_TO_BOOL : BOOL
+  VAR_INPUT IN: UDINT; END_VAR
+  VAR_OUTPUT OUT: BOOL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UDINT_TO_TIME : TIME
+  VAR_INPUT IN: UDINT; END_VAR
+  VAR_OUTPUT OUT: TIME; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UDINT_TO_INT : INT
+  VAR_INPUT IN: UDINT; END_VAR
+  VAR_OUTPUT OUT: INT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION WORD_TO_REAL : REAL
+  VAR_INPUT IN: WORD; END_VAR
+  VAR_OUTPUT OUT: REAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION WORD_TO_SINT : SINT
+  VAR_INPUT IN: WORD; END_VAR
+  VAR_OUTPUT OUT: SINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION WORD_TO_LINT : LINT
+  VAR_INPUT IN: WORD; END_VAR
+  VAR_OUTPUT OUT: LINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION WORD_TO_DINT : DINT
+  VAR_INPUT IN: WORD; END_VAR
+  VAR_OUTPUT OUT: DINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION WORD_TO_DATE : DATE
+  VAR_INPUT IN: WORD; END_VAR
+  VAR_OUTPUT OUT: DATE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION WORD_TO_DWORD : DWORD
+  VAR_INPUT IN: WORD; END_VAR
+  VAR_OUTPUT OUT: DWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION WORD_TO_DT : DT
+  VAR_INPUT IN: WORD; END_VAR
+  VAR_OUTPUT OUT: DT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION WORD_TO_TOD : TOD
+  VAR_INPUT IN: WORD; END_VAR
+  VAR_OUTPUT OUT: TOD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION WORD_TO_UDINT : UDINT
+  VAR_INPUT IN: WORD; END_VAR
+  VAR_OUTPUT OUT: UDINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION WORD_TO_STRING : STRING
+  VAR_INPUT IN: WORD; END_VAR
+  VAR_OUTPUT OUT: STRING; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION WORD_TO_LWORD : LWORD
+  VAR_INPUT IN: WORD; END_VAR
+  VAR_OUTPUT OUT: LWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION WORD_TO_UINT : UINT
+  VAR_INPUT IN: WORD; END_VAR
+  VAR_OUTPUT OUT: UINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION WORD_TO_LREAL : LREAL
+  VAR_INPUT IN: WORD; END_VAR
+  VAR_OUTPUT OUT: LREAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION WORD_TO_BYTE : BYTE
+  VAR_INPUT IN: WORD; END_VAR
+  VAR_OUTPUT OUT: BYTE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION WORD_TO_USINT : USINT
+  VAR_INPUT IN: WORD; END_VAR
+  VAR_OUTPUT OUT: USINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION WORD_TO_ULINT : ULINT
+  VAR_INPUT IN: WORD; END_VAR
+  VAR_OUTPUT OUT: ULINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION WORD_TO_BOOL : BOOL
+  VAR_INPUT IN: WORD; END_VAR
+  VAR_OUTPUT OUT: BOOL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION WORD_TO_TIME : TIME
+  VAR_INPUT IN: WORD; END_VAR
+  VAR_OUTPUT OUT: TIME; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION WORD_TO_INT : INT
+  VAR_INPUT IN: WORD; END_VAR
+  VAR_OUTPUT OUT: INT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION STRING_TO_REAL : REAL
+  VAR_INPUT IN: STRING; END_VAR
+  VAR_OUTPUT OUT: REAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION STRING_TO_SINT : SINT
+  VAR_INPUT IN: STRING; END_VAR
+  VAR_OUTPUT OUT: SINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION STRING_TO_LINT : LINT
+  VAR_INPUT IN: STRING; END_VAR
+  VAR_OUTPUT OUT: LINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION STRING_TO_DINT : DINT
+  VAR_INPUT IN: STRING; END_VAR
+  VAR_OUTPUT OUT: DINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION STRING_TO_DATE : DATE
+  VAR_INPUT IN: STRING; END_VAR
+  VAR_OUTPUT OUT: DATE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION STRING_TO_DWORD : DWORD
+  VAR_INPUT IN: STRING; END_VAR
+  VAR_OUTPUT OUT: DWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION STRING_TO_DT : DT
+  VAR_INPUT IN: STRING; END_VAR
+  VAR_OUTPUT OUT: DT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION STRING_TO_TOD : TOD
+  VAR_INPUT IN: STRING; END_VAR
+  VAR_OUTPUT OUT: TOD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION STRING_TO_UDINT : UDINT
+  VAR_INPUT IN: STRING; END_VAR
+  VAR_OUTPUT OUT: UDINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION STRING_TO_WORD : WORD
+  VAR_INPUT IN: STRING; END_VAR
+  VAR_OUTPUT OUT: WORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION STRING_TO_LWORD : LWORD
+  VAR_INPUT IN: STRING; END_VAR
+  VAR_OUTPUT OUT: LWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION STRING_TO_UINT : UINT
+  VAR_INPUT IN: STRING; END_VAR
+  VAR_OUTPUT OUT: UINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION STRING_TO_LREAL : LREAL
+  VAR_INPUT IN: STRING; END_VAR
+  VAR_OUTPUT OUT: LREAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION STRING_TO_BYTE : BYTE
+  VAR_INPUT IN: STRING; END_VAR
+  VAR_OUTPUT OUT: BYTE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION STRING_TO_USINT : USINT
+  VAR_INPUT IN: STRING; END_VAR
+  VAR_OUTPUT OUT: USINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION STRING_TO_ULINT : ULINT
+  VAR_INPUT IN: STRING; END_VAR
+  VAR_OUTPUT OUT: ULINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION STRING_TO_BOOL : BOOL
+  VAR_INPUT IN: STRING; END_VAR
+  VAR_OUTPUT OUT: BOOL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION STRING_TO_TIME : TIME
+  VAR_INPUT IN: STRING; END_VAR
+  VAR_OUTPUT OUT: TIME; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION STRING_TO_INT : INT
+  VAR_INPUT IN: STRING; END_VAR
+  VAR_OUTPUT OUT: INT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LWORD_TO_REAL : REAL
+  VAR_INPUT IN: LWORD; END_VAR
+  VAR_OUTPUT OUT: REAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LWORD_TO_SINT : SINT
+  VAR_INPUT IN: LWORD; END_VAR
+  VAR_OUTPUT OUT: SINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LWORD_TO_LINT : LINT
+  VAR_INPUT IN: LWORD; END_VAR
+  VAR_OUTPUT OUT: LINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LWORD_TO_DINT : DINT
+  VAR_INPUT IN: LWORD; END_VAR
+  VAR_OUTPUT OUT: DINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LWORD_TO_DATE : DATE
+  VAR_INPUT IN: LWORD; END_VAR
+  VAR_OUTPUT OUT: DATE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LWORD_TO_DWORD : DWORD
+  VAR_INPUT IN: LWORD; END_VAR
+  VAR_OUTPUT OUT: DWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LWORD_TO_DT : DT
+  VAR_INPUT IN: LWORD; END_VAR
+  VAR_OUTPUT OUT: DT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LWORD_TO_TOD : TOD
+  VAR_INPUT IN: LWORD; END_VAR
+  VAR_OUTPUT OUT: TOD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LWORD_TO_UDINT : UDINT
+  VAR_INPUT IN: LWORD; END_VAR
+  VAR_OUTPUT OUT: UDINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LWORD_TO_WORD : WORD
+  VAR_INPUT IN: LWORD; END_VAR
+  VAR_OUTPUT OUT: WORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LWORD_TO_STRING : STRING
+  VAR_INPUT IN: LWORD; END_VAR
+  VAR_OUTPUT OUT: STRING; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LWORD_TO_UINT : UINT
+  VAR_INPUT IN: LWORD; END_VAR
+  VAR_OUTPUT OUT: UINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LWORD_TO_LREAL : LREAL
+  VAR_INPUT IN: LWORD; END_VAR
+  VAR_OUTPUT OUT: LREAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LWORD_TO_BYTE : BYTE
+  VAR_INPUT IN: LWORD; END_VAR
+  VAR_OUTPUT OUT: BYTE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LWORD_TO_USINT : USINT
+  VAR_INPUT IN: LWORD; END_VAR
+  VAR_OUTPUT OUT: USINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LWORD_TO_ULINT : ULINT
+  VAR_INPUT IN: LWORD; END_VAR
+  VAR_OUTPUT OUT: ULINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LWORD_TO_BOOL : BOOL
+  VAR_INPUT IN: LWORD; END_VAR
+  VAR_OUTPUT OUT: BOOL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LWORD_TO_TIME : TIME
+  VAR_INPUT IN: LWORD; END_VAR
+  VAR_OUTPUT OUT: TIME; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LWORD_TO_INT : INT
+  VAR_INPUT IN: LWORD; END_VAR
+  VAR_OUTPUT OUT: INT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UINT_TO_REAL : REAL
+  VAR_INPUT IN: UINT; END_VAR
+  VAR_OUTPUT OUT: REAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UINT_TO_SINT : SINT
+  VAR_INPUT IN: UINT; END_VAR
+  VAR_OUTPUT OUT: SINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UINT_TO_LINT : LINT
+  VAR_INPUT IN: UINT; END_VAR
+  VAR_OUTPUT OUT: LINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UINT_TO_DINT : DINT
+  VAR_INPUT IN: UINT; END_VAR
+  VAR_OUTPUT OUT: DINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UINT_TO_DATE : DATE
+  VAR_INPUT IN: UINT; END_VAR
+  VAR_OUTPUT OUT: DATE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UINT_TO_DWORD : DWORD
+  VAR_INPUT IN: UINT; END_VAR
+  VAR_OUTPUT OUT: DWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UINT_TO_DT : DT
+  VAR_INPUT IN: UINT; END_VAR
+  VAR_OUTPUT OUT: DT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UINT_TO_TOD : TOD
+  VAR_INPUT IN: UINT; END_VAR
+  VAR_OUTPUT OUT: TOD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UINT_TO_UDINT : UDINT
+  VAR_INPUT IN: UINT; END_VAR
+  VAR_OUTPUT OUT: UDINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UINT_TO_WORD : WORD
+  VAR_INPUT IN: UINT; END_VAR
+  VAR_OUTPUT OUT: WORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UINT_TO_STRING : STRING
+  VAR_INPUT IN: UINT; END_VAR
+  VAR_OUTPUT OUT: STRING; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UINT_TO_LWORD : LWORD
+  VAR_INPUT IN: UINT; END_VAR
+  VAR_OUTPUT OUT: LWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UINT_TO_LREAL : LREAL
+  VAR_INPUT IN: UINT; END_VAR
+  VAR_OUTPUT OUT: LREAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UINT_TO_BYTE : BYTE
+  VAR_INPUT IN: UINT; END_VAR
+  VAR_OUTPUT OUT: BYTE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UINT_TO_USINT : USINT
+  VAR_INPUT IN: UINT; END_VAR
+  VAR_OUTPUT OUT: USINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UINT_TO_ULINT : ULINT
+  VAR_INPUT IN: UINT; END_VAR
+  VAR_OUTPUT OUT: ULINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UINT_TO_BOOL : BOOL
+  VAR_INPUT IN: UINT; END_VAR
+  VAR_OUTPUT OUT: BOOL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UINT_TO_TIME : TIME
+  VAR_INPUT IN: UINT; END_VAR
+  VAR_OUTPUT OUT: TIME; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UINT_TO_INT : INT
+  VAR_INPUT IN: UINT; END_VAR
+  VAR_OUTPUT OUT: INT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LREAL_TO_REAL : REAL
+  VAR_INPUT IN: LREAL; END_VAR
+  VAR_OUTPUT OUT: REAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LREAL_TO_SINT : SINT
+  VAR_INPUT IN: LREAL; END_VAR
+  VAR_OUTPUT OUT: SINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LREAL_TO_LINT : LINT
+  VAR_INPUT IN: LREAL; END_VAR
+  VAR_OUTPUT OUT: LINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LREAL_TO_DINT : DINT
+  VAR_INPUT IN: LREAL; END_VAR
+  VAR_OUTPUT OUT: DINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LREAL_TO_DATE : DATE
+  VAR_INPUT IN: LREAL; END_VAR
+  VAR_OUTPUT OUT: DATE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LREAL_TO_DWORD : DWORD
+  VAR_INPUT IN: LREAL; END_VAR
+  VAR_OUTPUT OUT: DWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LREAL_TO_DT : DT
+  VAR_INPUT IN: LREAL; END_VAR
+  VAR_OUTPUT OUT: DT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LREAL_TO_TOD : TOD
+  VAR_INPUT IN: LREAL; END_VAR
+  VAR_OUTPUT OUT: TOD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LREAL_TO_UDINT : UDINT
+  VAR_INPUT IN: LREAL; END_VAR
+  VAR_OUTPUT OUT: UDINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LREAL_TO_WORD : WORD
+  VAR_INPUT IN: LREAL; END_VAR
+  VAR_OUTPUT OUT: WORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LREAL_TO_STRING : STRING
+  VAR_INPUT IN: LREAL; END_VAR
+  VAR_OUTPUT OUT: STRING; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LREAL_TO_LWORD : LWORD
+  VAR_INPUT IN: LREAL; END_VAR
+  VAR_OUTPUT OUT: LWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LREAL_TO_UINT : UINT
+  VAR_INPUT IN: LREAL; END_VAR
+  VAR_OUTPUT OUT: UINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LREAL_TO_BYTE : BYTE
+  VAR_INPUT IN: LREAL; END_VAR
+  VAR_OUTPUT OUT: BYTE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LREAL_TO_USINT : USINT
+  VAR_INPUT IN: LREAL; END_VAR
+  VAR_OUTPUT OUT: USINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LREAL_TO_ULINT : ULINT
+  VAR_INPUT IN: LREAL; END_VAR
+  VAR_OUTPUT OUT: ULINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LREAL_TO_BOOL : BOOL
+  VAR_INPUT IN: LREAL; END_VAR
+  VAR_OUTPUT OUT: BOOL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LREAL_TO_TIME : TIME
+  VAR_INPUT IN: LREAL; END_VAR
+  VAR_OUTPUT OUT: TIME; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LREAL_TO_INT : INT
+  VAR_INPUT IN: LREAL; END_VAR
+  VAR_OUTPUT OUT: INT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BYTE_TO_REAL : REAL
+  VAR_INPUT IN: BYTE; END_VAR
+  VAR_OUTPUT OUT: REAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BYTE_TO_SINT : SINT
+  VAR_INPUT IN: BYTE; END_VAR
+  VAR_OUTPUT OUT: SINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BYTE_TO_LINT : LINT
+  VAR_INPUT IN: BYTE; END_VAR
+  VAR_OUTPUT OUT: LINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BYTE_TO_DINT : DINT
+  VAR_INPUT IN: BYTE; END_VAR
+  VAR_OUTPUT OUT: DINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BYTE_TO_DATE : DATE
+  VAR_INPUT IN: BYTE; END_VAR
+  VAR_OUTPUT OUT: DATE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BYTE_TO_DWORD : DWORD
+  VAR_INPUT IN: BYTE; END_VAR
+  VAR_OUTPUT OUT: DWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BYTE_TO_DT : DT
+  VAR_INPUT IN: BYTE; END_VAR
+  VAR_OUTPUT OUT: DT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BYTE_TO_TOD : TOD
+  VAR_INPUT IN: BYTE; END_VAR
+  VAR_OUTPUT OUT: TOD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BYTE_TO_UDINT : UDINT
+  VAR_INPUT IN: BYTE; END_VAR
+  VAR_OUTPUT OUT: UDINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BYTE_TO_WORD : WORD
+  VAR_INPUT IN: BYTE; END_VAR
+  VAR_OUTPUT OUT: WORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BYTE_TO_STRING : STRING
+  VAR_INPUT IN: BYTE; END_VAR
+  VAR_OUTPUT OUT: STRING; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BYTE_TO_LWORD : LWORD
+  VAR_INPUT IN: BYTE; END_VAR
+  VAR_OUTPUT OUT: LWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BYTE_TO_UINT : UINT
+  VAR_INPUT IN: BYTE; END_VAR
+  VAR_OUTPUT OUT: UINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BYTE_TO_LREAL : LREAL
+  VAR_INPUT IN: BYTE; END_VAR
+  VAR_OUTPUT OUT: LREAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BYTE_TO_USINT : USINT
+  VAR_INPUT IN: BYTE; END_VAR
+  VAR_OUTPUT OUT: USINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BYTE_TO_ULINT : ULINT
+  VAR_INPUT IN: BYTE; END_VAR
+  VAR_OUTPUT OUT: ULINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BYTE_TO_BOOL : BOOL
+  VAR_INPUT IN: BYTE; END_VAR
+  VAR_OUTPUT OUT: BOOL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BYTE_TO_TIME : TIME
+  VAR_INPUT IN: BYTE; END_VAR
+  VAR_OUTPUT OUT: TIME; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BYTE_TO_INT : INT
+  VAR_INPUT IN: BYTE; END_VAR
+  VAR_OUTPUT OUT: INT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION USINT_TO_REAL : REAL
+  VAR_INPUT IN: USINT; END_VAR
+  VAR_OUTPUT OUT: REAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION USINT_TO_SINT : SINT
+  VAR_INPUT IN: USINT; END_VAR
+  VAR_OUTPUT OUT: SINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION USINT_TO_LINT : LINT
+  VAR_INPUT IN: USINT; END_VAR
+  VAR_OUTPUT OUT: LINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION USINT_TO_DINT : DINT
+  VAR_INPUT IN: USINT; END_VAR
+  VAR_OUTPUT OUT: DINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION USINT_TO_DATE : DATE
+  VAR_INPUT IN: USINT; END_VAR
+  VAR_OUTPUT OUT: DATE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION USINT_TO_DWORD : DWORD
+  VAR_INPUT IN: USINT; END_VAR
+  VAR_OUTPUT OUT: DWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION USINT_TO_DT : DT
+  VAR_INPUT IN: USINT; END_VAR
+  VAR_OUTPUT OUT: DT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION USINT_TO_TOD : TOD
+  VAR_INPUT IN: USINT; END_VAR
+  VAR_OUTPUT OUT: TOD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION USINT_TO_UDINT : UDINT
+  VAR_INPUT IN: USINT; END_VAR
+  VAR_OUTPUT OUT: UDINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION USINT_TO_WORD : WORD
+  VAR_INPUT IN: USINT; END_VAR
+  VAR_OUTPUT OUT: WORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION USINT_TO_STRING : STRING
+  VAR_INPUT IN: USINT; END_VAR
+  VAR_OUTPUT OUT: STRING; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION USINT_TO_LWORD : LWORD
+  VAR_INPUT IN: USINT; END_VAR
+  VAR_OUTPUT OUT: LWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION USINT_TO_UINT : UINT
+  VAR_INPUT IN: USINT; END_VAR
+  VAR_OUTPUT OUT: UINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION USINT_TO_LREAL : LREAL
+  VAR_INPUT IN: USINT; END_VAR
+  VAR_OUTPUT OUT: LREAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION USINT_TO_BYTE : BYTE
+  VAR_INPUT IN: USINT; END_VAR
+  VAR_OUTPUT OUT: BYTE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION USINT_TO_ULINT : ULINT
+  VAR_INPUT IN: USINT; END_VAR
+  VAR_OUTPUT OUT: ULINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION USINT_TO_BOOL : BOOL
+  VAR_INPUT IN: USINT; END_VAR
+  VAR_OUTPUT OUT: BOOL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION USINT_TO_TIME : TIME
+  VAR_INPUT IN: USINT; END_VAR
+  VAR_OUTPUT OUT: TIME; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION USINT_TO_INT : INT
+  VAR_INPUT IN: USINT; END_VAR
+  VAR_OUTPUT OUT: INT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION ULINT_TO_REAL : REAL
+  VAR_INPUT IN: ULINT; END_VAR
+  VAR_OUTPUT OUT: REAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION ULINT_TO_SINT : SINT
+  VAR_INPUT IN: ULINT; END_VAR
+  VAR_OUTPUT OUT: SINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION ULINT_TO_LINT : LINT
+  VAR_INPUT IN: ULINT; END_VAR
+  VAR_OUTPUT OUT: LINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION ULINT_TO_DINT : DINT
+  VAR_INPUT IN: ULINT; END_VAR
+  VAR_OUTPUT OUT: DINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION ULINT_TO_DATE : DATE
+  VAR_INPUT IN: ULINT; END_VAR
+  VAR_OUTPUT OUT: DATE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION ULINT_TO_DWORD : DWORD
+  VAR_INPUT IN: ULINT; END_VAR
+  VAR_OUTPUT OUT: DWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION ULINT_TO_DT : DT
+  VAR_INPUT IN: ULINT; END_VAR
+  VAR_OUTPUT OUT: DT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION ULINT_TO_TOD : TOD
+  VAR_INPUT IN: ULINT; END_VAR
+  VAR_OUTPUT OUT: TOD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION ULINT_TO_UDINT : UDINT
+  VAR_INPUT IN: ULINT; END_VAR
+  VAR_OUTPUT OUT: UDINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION ULINT_TO_WORD : WORD
+  VAR_INPUT IN: ULINT; END_VAR
+  VAR_OUTPUT OUT: WORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION ULINT_TO_STRING : STRING
+  VAR_INPUT IN: ULINT; END_VAR
+  VAR_OUTPUT OUT: STRING; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION ULINT_TO_LWORD : LWORD
+  VAR_INPUT IN: ULINT; END_VAR
+  VAR_OUTPUT OUT: LWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION ULINT_TO_UINT : UINT
+  VAR_INPUT IN: ULINT; END_VAR
+  VAR_OUTPUT OUT: UINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION ULINT_TO_LREAL : LREAL
+  VAR_INPUT IN: ULINT; END_VAR
+  VAR_OUTPUT OUT: LREAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION ULINT_TO_BYTE : BYTE
+  VAR_INPUT IN: ULINT; END_VAR
+  VAR_OUTPUT OUT: BYTE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION ULINT_TO_USINT : USINT
+  VAR_INPUT IN: ULINT; END_VAR
+  VAR_OUTPUT OUT: USINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION ULINT_TO_BOOL : BOOL
+  VAR_INPUT IN: ULINT; END_VAR
+  VAR_OUTPUT OUT: BOOL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION ULINT_TO_TIME : TIME
+  VAR_INPUT IN: ULINT; END_VAR
+  VAR_OUTPUT OUT: TIME; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION ULINT_TO_INT : INT
+  VAR_INPUT IN: ULINT; END_VAR
+  VAR_OUTPUT OUT: INT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BOOL_TO_REAL : REAL
+  VAR_INPUT IN: BOOL; END_VAR
+  VAR_OUTPUT OUT: REAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BOOL_TO_SINT : SINT
+  VAR_INPUT IN: BOOL; END_VAR
+  VAR_OUTPUT OUT: SINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BOOL_TO_LINT : LINT
+  VAR_INPUT IN: BOOL; END_VAR
+  VAR_OUTPUT OUT: LINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BOOL_TO_DINT : DINT
+  VAR_INPUT IN: BOOL; END_VAR
+  VAR_OUTPUT OUT: DINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BOOL_TO_DATE : DATE
+  VAR_INPUT IN: BOOL; END_VAR
+  VAR_OUTPUT OUT: DATE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BOOL_TO_DWORD : DWORD
+  VAR_INPUT IN: BOOL; END_VAR
+  VAR_OUTPUT OUT: DWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BOOL_TO_DT : DT
+  VAR_INPUT IN: BOOL; END_VAR
+  VAR_OUTPUT OUT: DT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BOOL_TO_TOD : TOD
+  VAR_INPUT IN: BOOL; END_VAR
+  VAR_OUTPUT OUT: TOD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BOOL_TO_UDINT : UDINT
+  VAR_INPUT IN: BOOL; END_VAR
+  VAR_OUTPUT OUT: UDINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BOOL_TO_WORD : WORD
+  VAR_INPUT IN: BOOL; END_VAR
+  VAR_OUTPUT OUT: WORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BOOL_TO_STRING : STRING
+  VAR_INPUT IN: BOOL; END_VAR
+  VAR_OUTPUT OUT: STRING; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BOOL_TO_LWORD : LWORD
+  VAR_INPUT IN: BOOL; END_VAR
+  VAR_OUTPUT OUT: LWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BOOL_TO_UINT : UINT
+  VAR_INPUT IN: BOOL; END_VAR
+  VAR_OUTPUT OUT: UINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BOOL_TO_LREAL : LREAL
+  VAR_INPUT IN: BOOL; END_VAR
+  VAR_OUTPUT OUT: LREAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BOOL_TO_BYTE : BYTE
+  VAR_INPUT IN: BOOL; END_VAR
+  VAR_OUTPUT OUT: BYTE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BOOL_TO_USINT : USINT
+  VAR_INPUT IN: BOOL; END_VAR
+  VAR_OUTPUT OUT: USINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BOOL_TO_ULINT : ULINT
+  VAR_INPUT IN: BOOL; END_VAR
+  VAR_OUTPUT OUT: ULINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BOOL_TO_TIME : TIME
+  VAR_INPUT IN: BOOL; END_VAR
+  VAR_OUTPUT OUT: TIME; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BOOL_TO_INT : INT
+  VAR_INPUT IN: BOOL; END_VAR
+  VAR_OUTPUT OUT: INT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION TIME_TO_REAL : REAL
+  VAR_INPUT IN: TIME; END_VAR
+  VAR_OUTPUT OUT: REAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION TIME_TO_SINT : SINT
+  VAR_INPUT IN: TIME; END_VAR
+  VAR_OUTPUT OUT: SINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION TIME_TO_LINT : LINT
+  VAR_INPUT IN: TIME; END_VAR
+  VAR_OUTPUT OUT: LINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION TIME_TO_DINT : DINT
+  VAR_INPUT IN: TIME; END_VAR
+  VAR_OUTPUT OUT: DINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION TIME_TO_DWORD : DWORD
+  VAR_INPUT IN: TIME; END_VAR
+  VAR_OUTPUT OUT: DWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION TIME_TO_UDINT : UDINT
+  VAR_INPUT IN: TIME; END_VAR
+  VAR_OUTPUT OUT: UDINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION TIME_TO_WORD : WORD
+  VAR_INPUT IN: TIME; END_VAR
+  VAR_OUTPUT OUT: WORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION TIME_TO_STRING : STRING
+  VAR_INPUT IN: TIME; END_VAR
+  VAR_OUTPUT OUT: STRING; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION TIME_TO_LWORD : LWORD
+  VAR_INPUT IN: TIME; END_VAR
+  VAR_OUTPUT OUT: LWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION TIME_TO_UINT : UINT
+  VAR_INPUT IN: TIME; END_VAR
+  VAR_OUTPUT OUT: UINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION TIME_TO_LREAL : LREAL
+  VAR_INPUT IN: TIME; END_VAR
+  VAR_OUTPUT OUT: LREAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION TIME_TO_BYTE : BYTE
+  VAR_INPUT IN: TIME; END_VAR
+  VAR_OUTPUT OUT: BYTE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION TIME_TO_USINT : USINT
+  VAR_INPUT IN: TIME; END_VAR
+  VAR_OUTPUT OUT: USINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION TIME_TO_ULINT : ULINT
+  VAR_INPUT IN: TIME; END_VAR
+  VAR_OUTPUT OUT: ULINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION TIME_TO_INT : INT
+  VAR_INPUT IN: TIME; END_VAR
+  VAR_OUTPUT OUT: INT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION INT_TO_REAL : REAL
+  VAR_INPUT IN: INT; END_VAR
+  VAR_OUTPUT OUT: REAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION INT_TO_SINT : SINT
+  VAR_INPUT IN: INT; END_VAR
+  VAR_OUTPUT OUT: SINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION INT_TO_LINT : LINT
+  VAR_INPUT IN: INT; END_VAR
+  VAR_OUTPUT OUT: LINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION INT_TO_DINT : DINT
+  VAR_INPUT IN: INT; END_VAR
+  VAR_OUTPUT OUT: DINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION INT_TO_DATE : DATE
+  VAR_INPUT IN: INT; END_VAR
+  VAR_OUTPUT OUT: DATE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION INT_TO_DWORD : DWORD
+  VAR_INPUT IN: INT; END_VAR
+  VAR_OUTPUT OUT: DWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION INT_TO_DT : DT
+  VAR_INPUT IN: INT; END_VAR
+  VAR_OUTPUT OUT: DT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION INT_TO_TOD : TOD
+  VAR_INPUT IN: INT; END_VAR
+  VAR_OUTPUT OUT: TOD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION INT_TO_UDINT : UDINT
+  VAR_INPUT IN: INT; END_VAR
+  VAR_OUTPUT OUT: UDINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION INT_TO_WORD : WORD
+  VAR_INPUT IN: INT; END_VAR
+  VAR_OUTPUT OUT: WORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION INT_TO_STRING : STRING
+  VAR_INPUT IN: INT; END_VAR
+  VAR_OUTPUT OUT: STRING; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION INT_TO_LWORD : LWORD
+  VAR_INPUT IN: INT; END_VAR
+  VAR_OUTPUT OUT: LWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION INT_TO_UINT : UINT
+  VAR_INPUT IN: INT; END_VAR
+  VAR_OUTPUT OUT: UINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION INT_TO_LREAL : LREAL
+  VAR_INPUT IN: INT; END_VAR
+  VAR_OUTPUT OUT: LREAL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION INT_TO_BYTE : BYTE
+  VAR_INPUT IN: INT; END_VAR
+  VAR_OUTPUT OUT: BYTE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION INT_TO_USINT : USINT
+  VAR_INPUT IN: INT; END_VAR
+  VAR_OUTPUT OUT: USINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION INT_TO_ULINT : ULINT
+  VAR_INPUT IN: INT; END_VAR
+  VAR_OUTPUT OUT: ULINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION INT_TO_BOOL : BOOL
+  VAR_INPUT IN: INT; END_VAR
+  VAR_OUTPUT OUT: BOOL; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION INT_TO_TIME : TIME
+  VAR_INPUT IN: INT; END_VAR
+  VAR_OUTPUT OUT: TIME; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DATE_AND_TIME_TO_TIME_OF_DAY : TIME_OF_DAY
+  VAR_INPUT IN: DATE_AND_TIME; END_VAR
+  VAR_OUTPUT OUT: TIME_OF_DAY; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DATE_AND_TIME_TO_DATE : DATE
+  VAR_INPUT IN: DATE_AND_TIME; END_VAR
+  VAR_OUTPUT OUT: DATE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+(*   *BCD_TO_**   and   **_TO_BCD*     are not yet supported  *)
+(*  We comment them out for now...                            *)
+(*
+
+
+FUNCTION UDINT_TO_BCD_BYTE : BYTE
+  VAR_INPUT IN: UDINT; END_VAR
+  VAR_OUTPUT OUT: BYTE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UDINT_TO_BCD_WORD : WORD
+  VAR_INPUT IN: UDINT; END_VAR
+  VAR_OUTPUT OUT: WORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UDINT_TO_BCD_DWORD : DWORD
+  VAR_INPUT IN: UDINT; END_VAR
+  VAR_OUTPUT OUT: DWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UDINT_TO_BCD_LWORD : LWORD
+  VAR_INPUT IN: UDINT; END_VAR
+  VAR_OUTPUT OUT: LWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UINT_TO_BCD_BYTE : BYTE
+  VAR_INPUT IN: UINT; END_VAR
+  VAR_OUTPUT OUT: BYTE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UINT_TO_BCD_WORD : WORD
+  VAR_INPUT IN: UINT; END_VAR
+  VAR_OUTPUT OUT: WORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UINT_TO_BCD_DWORD : DWORD
+  VAR_INPUT IN: UINT; END_VAR
+  VAR_OUTPUT OUT: DWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION UINT_TO_BCD_LWORD : LWORD
+  VAR_INPUT IN: UINT; END_VAR
+  VAR_OUTPUT OUT: LWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION USINT_TO_BCD_BYTE : BYTE
+  VAR_INPUT IN: USINT; END_VAR
+  VAR_OUTPUT OUT: BYTE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION USINT_TO_BCD_WORD : WORD
+  VAR_INPUT IN: USINT; END_VAR
+  VAR_OUTPUT OUT: WORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION USINT_TO_BCD_DWORD : DWORD
+  VAR_INPUT IN: USINT; END_VAR
+  VAR_OUTPUT OUT: DWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION USINT_TO_BCD_LWORD : LWORD
+  VAR_INPUT IN: USINT; END_VAR
+  VAR_OUTPUT OUT: LWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION ULINT_TO_BCD_BYTE : BYTE
+  VAR_INPUT IN: ULINT; END_VAR
+  VAR_OUTPUT OUT: BYTE; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION ULINT_TO_BCD_WORD : WORD
+  VAR_INPUT IN: ULINT; END_VAR
+  VAR_OUTPUT OUT: WORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION ULINT_TO_BCD_DWORD : DWORD
+  VAR_INPUT IN: ULINT; END_VAR
+  VAR_OUTPUT OUT: DWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION ULINT_TO_BCD_LWORD : LWORD
+  VAR_INPUT IN: ULINT; END_VAR
+  VAR_OUTPUT OUT: LWORD; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BYTE_BCD_TO_UDINT : UDINT
+  VAR_INPUT IN: BYTE; END_VAR
+  VAR_OUTPUT OUT: UDINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION WORD_BCD_TO_UDINT : UDINT
+  VAR_INPUT IN: WORD; END_VAR
+  VAR_OUTPUT OUT: UDINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DWORD_BCD_TO_UDINT : UDINT
+  VAR_INPUT IN: DWORD; END_VAR
+  VAR_OUTPUT OUT: UDINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LWORD_BCD_TO_UDINT : UDINT
+  VAR_INPUT IN: LWORD; END_VAR
+  VAR_OUTPUT OUT: UDINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BYTE_BCD_TO_UINT : UINT
+  VAR_INPUT IN: BYTE; END_VAR
+  VAR_OUTPUT OUT: UINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION WORD_BCD_TO_UINT : UINT
+  VAR_INPUT IN: WORD; END_VAR
+  VAR_OUTPUT OUT: UINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DWORD_BCD_TO_UINT : UINT
+  VAR_INPUT IN: DWORD; END_VAR
+  VAR_OUTPUT OUT: UINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LWORD_BCD_TO_UINT : UINT
+  VAR_INPUT IN: LWORD; END_VAR
+  VAR_OUTPUT OUT: UINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BYTE_BCD_TO_USINT : USINT
+  VAR_INPUT IN: BYTE; END_VAR
+  VAR_OUTPUT OUT: USINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION WORD_BCD_TO_USINT : USINT
+  VAR_INPUT IN: WORD; END_VAR
+  VAR_OUTPUT OUT: USINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DWORD_BCD_TO_USINT : USINT
+  VAR_INPUT IN: DWORD; END_VAR
+  VAR_OUTPUT OUT: USINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LWORD_BCD_TO_USINT : USINT
+  VAR_INPUT IN: LWORD; END_VAR
+  VAR_OUTPUT OUT: USINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION BYTE_BCD_TO_ULINT : ULINT
+  VAR_INPUT IN: BYTE; END_VAR
+  VAR_OUTPUT OUT: ULINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION WORD_BCD_TO_ULINT : ULINT
+  VAR_INPUT IN: WORD; END_VAR
+  VAR_OUTPUT OUT: ULINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION DWORD_BCD_TO_ULINT : ULINT
+  VAR_INPUT IN: DWORD; END_VAR
+  VAR_OUTPUT OUT: ULINT; END_VAR
+  LD TRUE
+END_FUNCTION
+
+
+FUNCTION LWORD_BCD_TO_ULINT : ULINT
+  VAR_INPUT IN: LWORD; END_VAR
+  VAR_OUTPUT OUT: ULINT; END_VAR
+  LD TRUE
+END_FUNCTION
+*)
+
+{disable code generation}
--- a/stage1_2/iec.flex	Fri Apr 01 12:19:32 2011 +0100
+++ b/stage1_2/iec.flex	Mon Apr 04 10:42:03 2011 +0100
@@ -91,6 +91,9 @@
  */
 %option noyy_top_state
 
+/* We will not be using unput() in our flex code... */
+%option nounput
+
 /**************************************************/
 /* External Variable and Function declarations... */
 /**************************************************/
@@ -151,6 +154,14 @@
 
 
 /* We will not be using unput() in our flex code... */
+/* NOTE: it seems that this #define is no longer needed, It has been 
+ * replaced by %option nounput.
+ * Should we simply delete it?
+ * For now leave it in, in case someone is using an old version of flex.
+ * In any case, the most harm that can result in a warning message
+ * when compiling iec.flex.c:
+ * warning: ‘void yyunput(int, char*)’ defined but not used
+ */
 #define YY_NO_UNPUT
 
 /* Variable defined by the bison parser.
@@ -445,8 +456,28 @@
 /* Prelimenary constructs... */
 /*****************************/
 
-
-/* A pragma... */
+/* In order to allow the declaration of POU prototypes (Function, FB, Program, ...),
+ * especially the prototypes of Functions and FBs defined in the standard
+ * (i.e. standard functions and FBs), we extend the IEC 61131-3 standard syntax 
+ * with two pragmas to indicate that the code is to be parsed (going through the 
+ * lexical, syntactical, and semantic analysers), but no code is to be generated.
+ * 
+ * The accepted syntax is:
+ *  {no_code_generation begin}
+ *    ... prototypes ...
+ *  {no_code_generation end}
+ * 
+ * When parsing these prototypes the abstract syntax tree will be populated as usual,
+ * allowing the semantic analyser to correctly analyse the semantics of calls to these
+ * functions/FBs. However, stage4 will simply ignore all IEC61131-3 code
+ * between the above two pragmas.
+ */
+
+disable_code_generation_pragma	"{disable code generation}"
+enable_code_generation_pragma	"{enable code generation}"
+
+
+/* Any other pragma... */
 
 pragma "{"[^}]*"}"
 
@@ -733,6 +764,12 @@
 	/* We start off by searching for the pragmas we handle in the lexical parser. */
 <INITIAL>{file_include_pragma}	unput_text(0); yy_push_state(include_beg);
 
+	/* Pragmas sent to syntax analyser (bison) */
+{disable_code_generation_pragma}               return disable_code_generation_pragma_token;
+{enable_code_generation_pragma}                return enable_code_generation_pragma_token;
+<body_state>{disable_code_generation_pragma}   return disable_code_generation_pragma_token;
+<body_state>{enable_code_generation_pragma}    return enable_code_generation_pragma_token;
+
 	/* Any other pragma we find, we just pass it up to the syntax parser...   */
 	/* Note that the <body_state> state is exclusive, so we have to include it here too. */
 {pragma}	{/* return the pragmma without the enclosing '{' and '}' */
@@ -971,6 +1008,7 @@
 <il_state>{il_whitespace_no_pragma}		/* Eat any whitespace */
 
 
+
 	/*****************************************/
 	/* B.1.1 Letters, digits and identifiers */
 	/*****************************************/
--- a/stage1_2/iec.y	Fri Apr 01 12:19:32 2011 +0100
+++ b/stage1_2/iec.y	Mon Apr 04 10:42:03 2011 +0100
@@ -290,11 +290,26 @@
 /* B XXX - Things that are missing from the standard, but should have been there! */
 /**********************************************************************************/
 
-
-/* The pragmas... */
+/* Pragmas that our compiler will accept.
+ * See the comment in iec.flex for why these pragmas exist. 
+ */
+%token          disable_code_generation_pragma_token
+%token          enable_code_generation_pragma_token
+%type <leaf>	disable_code_generation_pragma
+%type <leaf>	enable_code_generation_pragma
+
+
+/* All other pragmas that we do not support... */
+/* In most stage 4, the text inside the pragmas will simply be copied to the output file.
+ * This allows us to insert C code (if using stage 4 generating C code) 
+ * inside/interningled with the IEC 61131-3 code!
+ */
 %token <ID>	pragma_token
 %type <leaf>	pragma
 
+/* The joining of all previous pragmas, i.e. any possible pragma */
+%type <leaf>	any_pragma
+
 
 /* Where do these tokens belong?? They are missing from the standard! */
 /* NOTE: There are other tokens related to these 'EN' ENO', that are also 
@@ -1376,9 +1391,23 @@
 
 
 /* the pragmas... */
+
+
+disable_code_generation_pragma:
+  disable_code_generation_pragma_token	{$$ = new disable_code_generation_pragma_c(locloc(@$));}
+
+enable_code_generation_pragma:
+  enable_code_generation_pragma_token	{$$ = new enable_code_generation_pragma_c(locloc(@$));}
+
 pragma:
   pragma_token	{$$ = new pragma_c($1, locloc(@$));}
 
+any_pragma:
+  disable_code_generation_pragma
+| enable_code_generation_pragma
+| pragma
+;
+
 
 /* EN/ENO */
 /* Tese tokens are essentially used as variable names, so we handle them 
@@ -1484,6 +1513,8 @@
 	}
 | library library_element_declaration
 	{$$ = $1; $$->add_element($2);}
+| library any_pragma
+	{$$ = $1; $$->add_element($2);}
 /* ERROR_CHECK_BEGIN */
 | library error library_element_declaration
 	{$$ = $1; print_err_msg(locf(@2), locl(@2), "unknown syntax error."); yyerrok;}
@@ -6080,11 +6111,11 @@
 instruction_list:
   il_instruction
 	{$$ = new instruction_list_c(locloc(@$)); $$->add_element($1);}
-| pragma eol_list
+| any_pragma eol_list
 	{$$ = new instruction_list_c(locloc(@$)); $$->add_element($1);}
 | instruction_list il_instruction
 	{$$ = $1; $$->add_element($2);}
-| instruction_list pragma
+| instruction_list any_pragma
 	{$$ = $1; $$->add_element($2);}
 ;
 
@@ -7147,11 +7178,11 @@
 statement_list:
   statement ';'
 	{$$ = new statement_list_c(locloc(@$)); $$->add_element($1);}
-| pragma
+| any_pragma
 	{$$ = new statement_list_c(locloc(@$)); $$->add_element($1);}
 | statement_list statement ';'
 	{$$ = $1; $$->add_element($2);}
-| statement_list pragma
+| statement_list any_pragma
 	{$$ = $1; $$->add_element($2);}
 /* ERROR_CHECK_BEGIN */
 | statement error
--- a/stage1_2/standard_function_names.c	Fri Apr 01 12:19:32 2011 +0100
+++ b/stage1_2/standard_function_names.c	Mon Apr 04 10:42:03 2011 +0100
@@ -36,6 +36,7 @@
  
  
 const char *standard_function_names[] = {
+/*  
 "REAL_TO_SINT",
 "REAL_TO_LINT",
 "REAL_TO_DINT",
@@ -400,6 +401,7 @@
 "INT_TO_ULINT",
 "INT_TO_BOOL",
 "INT_TO_TIME",
+*/
 "TRUNC",
 "BCD_TO_UDINT",
 "BCD_TO_UINT",
@@ -409,8 +411,10 @@
 "UINT_TO_BCD",
 "USINT_TO_BCD",
 "ULINT_TO_BCD",
+/*
 "DATE_AND_TIME_TO_TIME_OF_DAY",
 "DATE_AND_TIME_TO_DATE",
+*/
 "ABS",
 "SQRT",
 "LN",
--- a/stage3/stage3.cc	Fri Apr 01 12:19:32 2011 +0100
+++ b/stage3/stage3.cc	Mon Apr 04 10:42:03 2011 +0100
@@ -1,24 +1,31 @@
 /*
- * (c) 2009 Mario de Sousa
+ *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
- * Offered to the public under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
+ *  Copyright (C) 2009-2011  Mario de Sousa (msousa@fe.up.pt)
  *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
- * Public License for more details.
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
  *
  * This code is made available on the understanding that it will not be
  * used in safety-critical situations without a full and competent review.
  */
 
 /*
- * An IEC 61131-3 IL and ST compiler.
+ * An IEC 61131-3 compiler.
  *
  * Based on the
- * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2009-04-24)
+ * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
  *
  */
 
--- a/stage3/stage3.hh	Fri Apr 01 12:19:32 2011 +0100
+++ b/stage3/stage3.hh	Mon Apr 04 10:42:03 2011 +0100
@@ -1,24 +1,31 @@
 /*
- * (c) 2009 Mario de Sousa
+ *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
- * Offered to the public under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
+ *  Copyright (C) 2009-2011  Mario de Sousa (msousa@fe.up.pt)
  *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
- * Public License for more details.
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
  *
  * This code is made available on the understanding that it will not be
  * used in safety-critical situations without a full and competent review.
  */
 
 /*
- * An IEC 61131-3 IL and ST compiler.
+ * An IEC 61131-3 compiler.
  *
  * Based on the
- * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2009-04-24)
+ * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
  *
  */
 
--- a/stage3/visit_expression_type.cc	Fri Apr 01 12:19:32 2011 +0100
+++ b/stage3/visit_expression_type.cc	Mon Apr 04 10:42:03 2011 +0100
@@ -1,21 +1,28 @@
 /*
- * (c) 2009 Mario de Sousa
+ *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
- * Offered to the public under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
+ *  Copyright (C) 2009-2011  Mario de Sousa (msousa@fe.up.pt)
  *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
- * Public License for more details.
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
  *
  * This code is made available on the understanding that it will not be
  * used in safety-critical situations without a full and competent review.
  */
 
 /*
- * An IEC 61131-3 IL and ST compiler.
+ * An IEC 61131-3 compiler.
  *
  * Based on the
  * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
--- a/stage3/visit_expression_type.hh	Fri Apr 01 12:19:32 2011 +0100
+++ b/stage3/visit_expression_type.hh	Mon Apr 04 10:42:03 2011 +0100
@@ -1,21 +1,28 @@
 /*
- * (c) 2003 Mario de Sousa
- *
- * Offered to the public under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
- * Public License for more details.
+ *  matiec - a compiler for the programming languages defined in IEC 61131-3
+ *
+ *  Copyright (C) 2009-2011  Mario de Sousa (msousa@fe.up.pt)
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
  *
  * This code is made available on the understanding that it will not be
  * used in safety-critical situations without a full and competent review.
  */
 
 /*
- * An IEC 61131-3 IL and ST compiler.
+ * An IEC 61131-3 compiler.
  *
  * Based on the
  * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
--- a/stage4/generate_c/generate_c.cc	Fri Apr 01 12:19:32 2011 +0100
+++ b/stage4/generate_c/generate_c.cc	Mon Apr 04 10:42:03 2011 +0100
@@ -1,21 +1,28 @@
 /*
- * (c) 2003 Mario de Sousa
+ *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
- * Offered to the public under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
+ *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
  *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
- * Public License for more details.
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
  *
  * This code is made available on the understanding that it will not be
  * used in safety-critical situations without a full and competent review.
  */
 
 /*
- * An IEC 61131-3 IL and ST compiler.
+ * An IEC 61131-3 compiler.
  *
  * Based on the
  * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
@@ -364,10 +371,16 @@
 
   public:
     generate_c_SFC_IL_ST_c(stage4out_c *s4o_ptr, symbol_c *name, symbol_c *scope, const char *variable_prefix = NULL);
+    
+    /********************/
+    /* 2.1.6 - Pragmas  */
+    /********************/
+    void *visit(enable_code_generation_pragma_c * symbol)   {s4o_ptr->enable_output();  return NULL;}
+    void *visit(disable_code_generation_pragma_c * symbol)  {s4o_ptr->disable_output(); return NULL;} 
+    
     /*********************************************/
     /* B.1.6  Sequential function chart elements */
     /*********************************************/
-    
     /*| sequential_function_chart sfc_network*/
     void *visit(sequential_function_chart_c * symbol);
     
@@ -438,14 +451,23 @@
 
 
 class generate_c_pous_c: public generate_c_typedecl_c {
-
+  private:
+    stage4out_c *s4o_ptr;
+    
   public:
     generate_c_pous_c(stage4out_c *s4o_ptr, stage4out_c *s4o_incl_ptr)
-      : generate_c_typedecl_c(s4o_ptr, s4o_incl_ptr) {};
+      : generate_c_typedecl_c(s4o_ptr, s4o_incl_ptr) {
+      generate_c_pous_c::s4o_ptr = s4o_ptr;
+    };
     virtual ~generate_c_pous_c(void) {}
 
 
   public:
+/********************/
+/* 2.1.6 - Pragmas  */
+/********************/
+void *visit(enable_code_generation_pragma_c * symbol)   {s4o_ptr->enable_output();  return NULL;}
+void *visit(disable_code_generation_pragma_c * symbol)  {s4o_ptr->disable_output(); return NULL;} 
 
 /*************************/
 /* B.1 - Common elements */
@@ -981,10 +1003,15 @@
 /***********************************************************************/
 
 class generate_c_config_c: public generate_c_typedecl_c {
+    private:
+    stage4out_c *s4o_ptr;
 
     public:
     generate_c_config_c(stage4out_c *s4o_ptr)
-      : generate_c_typedecl_c(s4o_ptr) {};
+      : generate_c_typedecl_c(s4o_ptr) {
+      generate_c_config_c::s4o_ptr = s4o_ptr;
+    };
+	
     virtual ~generate_c_config_c(void) {}
 
     typedef enum {
@@ -996,12 +1023,18 @@
 
     declaretype_t wanted_declaretype;
 
+    
+public:
+/********************/
+/* 2.1.6 - Pragmas  */
+/********************/
+void *visit(enable_code_generation_pragma_c * symbol)   {s4o_ptr->enable_output();  return NULL;}
+void *visit(disable_code_generation_pragma_c * symbol)  {s4o_ptr->disable_output(); return NULL;} 
+    
+    
 /********************************/
 /* B 1.7 Configuration elements */
 /********************************/
-
-
-public:
 /*
 CONFIGURATION configuration_name
    optional_global_var_declarations
@@ -1168,6 +1201,7 @@
     symbol_c *current_resource_name;
     symbol_c *current_task_name;
     symbol_c *current_global_vars;
+    stage4out_c *s4o_ptr;
 
   public:
     generate_c_resources_c(stage4out_c *s4o_ptr, symbol_c *config_scope, symbol_c *resource_scope, unsigned long time)
@@ -1178,7 +1212,9 @@
       current_resource_name = NULL;
       current_task_name = NULL;
       current_global_vars = NULL;
+      generate_c_resources_c::s4o_ptr = s4o_ptr;
     };
+
     virtual ~generate_c_resources_c(void) {
       delete search_config_instance;
       delete search_resource_instance;
@@ -1228,6 +1264,14 @@
       return NULL;
     }
 
+
+    /********************/
+    /* 2.1.6 - Pragmas  */
+    /********************/
+    void *visit(enable_code_generation_pragma_c * symbol)   {s4o_ptr->enable_output();  return NULL;}
+    void *visit(disable_code_generation_pragma_c * symbol)  {s4o_ptr->disable_output(); return NULL;} 
+    
+
     /******************************************/
     /* B 1.4.3 - Declaration & Initialisation */
     /******************************************/
@@ -1673,6 +1717,30 @@
             
     ~generate_c_c(void) {}
 
+
+
+/********************/
+/* 2.1.6 - Pragmas  */
+/********************/
+    void *visit(enable_code_generation_pragma_c * symbol)  {
+      s4o                  .enable_output();  
+      pous_s4o             .enable_output();  
+      pous_incl_s4o        .enable_output();  
+      located_variables_s4o.enable_output();  
+      variables_s4o        .enable_output();  
+      return NULL;
+    }
+    
+    void *visit(disable_code_generation_pragma_c * symbol)  {
+      s4o                  .disable_output();  
+      pous_s4o             .disable_output();  
+      pous_incl_s4o        .disable_output();  
+      located_variables_s4o.disable_output();  
+      variables_s4o        .disable_output();  
+      return NULL;
+    } 
+
+
 /***************************/
 /* B 0 - Programming Model */
 /***************************/
--- a/stage4/generate_c/generate_c.hh	Fri Apr 01 12:19:32 2011 +0100
+++ b/stage4/generate_c/generate_c.hh	Mon Apr 04 10:42:03 2011 +0100
@@ -1,21 +1,28 @@
 /*
- * (c) 2003 Mario de Sousa
+ *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
- * Offered to the public under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
+ *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
  *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
- * Public License for more details.
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
  *
  * This code is made available on the understanding that it will not be
  * used in safety-critical situations without a full and competent review.
  */
 
 /*
- * An IEC 61131-3 IL, ST and SFC compiler.
+ * An IEC 61131-3 compiler.
  *
  * Based on the
  * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
--- a/stage4/generate_c/generate_c_base.cc	Fri Apr 01 12:19:32 2011 +0100
+++ b/stage4/generate_c/generate_c_base.cc	Mon Apr 04 10:42:03 2011 +0100
@@ -267,9 +267,12 @@
       return NULL;
     }
 
-/***************************/
-/* 2.1.6 - Pragmas */
-/***************************/
+/********************/
+/* 2.1.6 - Pragmas  */
+/********************/
+    void *visit(enable_code_generation_pragma_c * symbol)   {s4o.enable_output();  return NULL;}
+    void *visit(disable_code_generation_pragma_c * symbol)  {s4o.disable_output(); return NULL;} 
+
     /* Do not use print_token() as it will change everything into uppercase */
     void *visit(pragma_c *symbol) {return s4o.print(symbol->value);}
 
--- a/stage4/generate_iec/generate_iec.cc	Fri Apr 01 12:19:32 2011 +0100
+++ b/stage4/generate_iec/generate_iec.cc	Mon Apr 04 10:42:03 2011 +0100
@@ -1,21 +1,28 @@
 /*
- * (c) 2003 Mario de Sousa
+ *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
- * Offered to the public under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
+ *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
  *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
- * Public License for more details.
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
  *
  * This code is made available on the understanding that it will not be
  * used in safety-critical situations without a full and competent review.
  */
 
 /*
- * An IEC 61131-3 IL and ST compiler.
+ * An IEC 61131-3 compiler.
  *
  * Based on the
  * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
@@ -147,10 +154,12 @@
 
 
 
-/***************************/
-/* 2.1.6 Pragmas */
-/***************************/
-void *visit(pragma_c *symbol) {return print_token(symbol);}
+/******************/
+/* 2.1.6 Pragmas  */
+/******************/
+void *visit(enable_code_generation_pragma_c*)  {s4o.print("{enable code generation}");  return NULL;}
+void *visit(disable_code_generation_pragma_c*) {s4o.print("{disable code generation}"); return NULL;}
+void *visit(pragma_c *symbol)                  {return print_token(symbol);}
 
 
 /***************************/
--- a/stage4/generate_iec/generate_iec.hh	Fri Apr 01 12:19:32 2011 +0100
+++ b/stage4/generate_iec/generate_iec.hh	Mon Apr 04 10:42:03 2011 +0100
@@ -1,21 +1,28 @@
 /*
- * (c) 2003 Mario de Sousa
+ *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
- * Offered to the public under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
+ *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
  *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
- * Public License for more details.
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
  *
  * This code is made available on the understanding that it will not be
  * used in safety-critical situations without a full and competent review.
  */
 
 /*
- * An IEC 61131-3 IL and ST compiler.
+ * An IEC 61131-3 compiler.
  *
  * Based on the
  * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
--- a/stage4/stage4.cc	Fri Apr 01 12:19:32 2011 +0100
+++ b/stage4/stage4.cc	Mon Apr 04 10:42:03 2011 +0100
@@ -1,21 +1,28 @@
 /*
- * (c) 2003 Mario de Sousa
- *
- * Offered to the public under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
- * Public License for more details.
+ *  matiec - a compiler for the programming languages defined in IEC 61131-3
+ *
+ *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
  *
  * This code is made available on the understanding that it will not be
  * used in safety-critical situations without a full and competent review.
  */
 
 /*
- * An IEC 61131-3 IL and ST compiler.
+ * An IEC 61131-3 compiler.
  *
  * Based on the
  * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
@@ -74,6 +81,7 @@
   m_file = file;
   this->indent_level = indent_level;
   this->indent_spaces = "";
+  allow_output = true;
 }
 
 stage4out_c::~stage4out_c(void) {
@@ -84,6 +92,13 @@
   }
 }
 
+void stage4out_c::enable_output(void) {
+  allow_output = true;
+}
+    
+void stage4out_c::disable_output(void) {
+  allow_output = false;
+}
 
 void stage4out_c::indent_right(void) {
   indent_spaces+=indent_level;
@@ -98,32 +113,38 @@
 
 
 void *stage4out_c::print(const char *str) {
+  if (!allow_output) return NULL;
   *out << str;
   return NULL;
 }
 
 void *stage4out_c::print_integer(int integer) {
+  if (!allow_output) return NULL;
   *out << integer;
   return NULL;
 }
 
 void *stage4out_c::print_long_integer(unsigned long l_integer) {
+  if (!allow_output) return NULL;
   *out << l_integer << "UL";
   return NULL;
 }
 
 void *stage4out_c::print_long_long_integer(unsigned long long ll_integer) {
+  if (!allow_output) return NULL;
   *out << ll_integer << "ULL";
   return NULL;
 }
 
 void *stage4out_c::printupper(const char *str) {
+  if (!allow_output) return NULL;
   for (int i = 0; str[i] != '\0'; i++)
     *out << (unsigned char)toupper(str[i]);
   return NULL;
 }
 
 void *stage4out_c::printlocation(const char *str) {
+  if (!allow_output) return NULL;
   *out << "__";
   for (int i = 0; str[i] != '\0'; i++)
     if(str[i] == '.')
@@ -134,6 +155,7 @@
 }
 
 void *stage4out_c::printlocation_comasep(const char *str) {
+  if (!allow_output) return NULL;
   *out << (unsigned char)toupper(str[0]);
   *out << ',';
   *out << (unsigned char)toupper(str[1]);
@@ -148,12 +170,14 @@
 
 
 void *stage4out_c::print(std::string str) {
+  if (!allow_output) return NULL;
   *out << str;
   return NULL;
 }
 
 
 void *stage4out_c::printupper(std::string str) {
+  if (!allow_output) return NULL;
   /* The string standard class does not have a converter member function to upper case.
    * We have to do it ourselves, a character at a time...
    */
@@ -170,6 +194,7 @@
 
 
 void *stage4out_c::printlocation(std::string str) {
+  if (!allow_output) return NULL;
   return printlocation(str.c_str());
 }
 
--- a/stage4/stage4.hh	Fri Apr 01 12:19:32 2011 +0100
+++ b/stage4/stage4.hh	Mon Apr 04 10:42:03 2011 +0100
@@ -1,21 +1,28 @@
 /*
- * (c) 2003 Mario de Sousa
+ *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
- * Offered to the public under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
+ *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
  *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
- * Public License for more details.
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
  *
  * This code is made available on the understanding that it will not be
  * used in safety-critical situations without a full and competent review.
  */
 
 /*
- * An IEC 61131-3 IL and ST compiler.
+ * An IEC 61131-3 compiler.
  *
  * Based on the
  * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
@@ -41,6 +48,9 @@
     stage4out_c(const char *dir, const char *radix, const char *extension, std::string indent_level = "  ");
     ~stage4out_c(void);
 
+    void enable_output(void);
+    void disable_output(void);
+
     void indent_right(void);
     void indent_left(void);
 
@@ -62,6 +72,13 @@
   protected:
     std::ostream *out;
     std::fstream *m_file;
+    
+    /* A flag to tell whether to really print to the file, or to ignore any request to print to the file */
+    /* This is used to implement the no_code_generation pragmas, that lets the user tell the compiler
+     * when to switch on and off the code generation, without stoping the lexical, syntatical, and
+     * semantic analysers from analysing the code.
+     */
+    bool allow_output;
 
 };
 
--- a/tests/syntax/identifier/identifier_as_variable1.test	Fri Apr 01 12:19:32 2011 +0100
+++ b/tests/syntax/identifier/identifier_as_variable1.test	Mon Apr 04 10:42:03 2011 +0100
@@ -40,35 +40,35 @@
 (* A helper FUNCTION BLOCK declaration *)
 function_block foo_fb
  var_input
-  a_1, b_1: int;
- end_var
- var_output
-  c_1, d_1: int;
- end_var
-  c_1 := 10 + b_1;
+  a_1, b_1: real;
+ end_var
+ var_output
+  c_1, d_1: real;
+ end_var
+  c_1 := 10.0 + b_1;
 end_function_block
 
 
 (* A helper FUNCTION declaration *)
-function foo_f1 : int
- var_input
-  a_1, b_1: int;
- end_var
- var_output
-  c_1, d_1: int;
- end_var
-  c_1 := 10 + b_1;
+function foo_f1 : real
+ var_input
+  a_1, b_1: real;
+ end_var
+ var_output
+  c_1, d_1: real;
+ end_var
+  c_1 := 10.0 + b_1;
 end_function
 
 (* Another helper FUNCTION declaration *)
-function foo_f2 : int
+function foo_f2 :real 
  var_input
   a_1, b_1: foo_fb;
  end_var
  var_output
-  c_1, d_1: int;
- end_var
-  c_1 := 10;
+  c_1, d_1: real;
+ end_var
+  c_1 := 10.0;
 end_function
 
 
@@ -77,11 +77,11 @@
 (* Testing use of XXXX in several locations of variable declarations *)
 (*********************************************************************)
 
-function bar01 : int
- var_input
-  XXXX, a_1, b_1: int;
- end_var
- a_1 := 1;
+function bar01 : real
+ var_input
+  XXXX, a_1, b_1: real;
+ end_var
+ a_1 := 1.0;
 end_function
 
 function_block bar02
@@ -187,21 +187,30 @@
 
 function_block bar90
  var
+  e_1, f_1 : real;
+  XXXX : real;
+  fb : foo_fb;
+ end_var
+  e_1 := bar01 (XXXX := 10.0);
+  e_1 := bar01 (a_1 := XXXX);
+  e_1 := bar01 (XXXX := XXXX);
+  fb(XXXX, 20.0);
+  fb (10.0, XXXX, e_1, f_1);
+  fb (a_1 := XXXX, b_1:=XXXX, c_1=>XXXX, d_1=>f_1);
+  fb(a_1 := 10.0, b_1:=20.0, c_1=>e_1, d_1=>XXXX);
+  fb (c_1=>XXXX, a_1:=20.0, d_1=>f_1);
+  XXXX := fb.c_1;
+  fb.a_1 := XXXX + XXXX * 2.0 * (XXXX) / foo_f1(XXXX, 10.0, XXXX, e_1) / XXXX ** XXXX;
+  IF (XXXX >= 10.0) THEN XXXX := 10.0; END_IF;
+end_function_block
+
+
+function_block bar90a
+ var
   e_1, f_1 : int;
   XXXX : int;
-  fb : foo_fb;
- end_var
-  e_1 := bar01 (XXXX := 10);
-  e_1 := bar01 (a_1 := XXXX);
-  e_1 := bar01 (XXXX := XXXX);
-  fb(XXXX, 20);
-  fb (10, XXXX, e_1, f_1);
-  fb (a_1 := XXXX, b_1:=XXXX, c_1=>XXXX, d_1=>f_1);
-  fb(a_1 := 10, b_1:=20, c_1=>e_1, d_1=>XXXX);
-  fb (c_1=>XXXX, a_1:=20, d_1=>f_1);
-  XXXX := fb.c_1;
-  fb.a_1 := XXXX + XXXX * 2 * (XXXX) / foo_f1(XXXX, 10, XXXX, e_1) MOD XXXX MOD XXXX ** XXXX;
-  IF (XXXX >= 10) THEN XXXX := 10; END_IF;
+ end_var
+  XXXX := XXXX MOD XXXX;
   CASE (XXXX + 10) OF
     10: XXXX := 10; 
     10..20:XXXX := 20;
@@ -234,19 +243,19 @@
 
 function_block bar91
  var
-  e_1, f_1 : int;
+  e_1, f_1 : real;
   XXXX : foo_fb;
  end_var
-  XXXX(e_1, 20);
-  XXXX (10, e_1, e_1, f_1);
+  XXXX(e_1, 20.0);
+  XXXX (10.0, e_1, e_1, f_1);
   XXXX (a_1 := e_1, b_1:=e_1 , c_1=>e_1, d_1=>f_1);
-  XXXX(a_1 := 10, b_1:=20, c_1=>e_1, d_1=>e_1);
-  XXXX (c_1=>e_1, a_1:=20, d_1=>f_1);
+  XXXX(a_1 := 10.0, b_1:=20.0, c_1=>e_1, d_1=>e_1);
+  XXXX (c_1=>e_1, a_1:=20.0, d_1=>f_1);
   e_1 := XXXX.c_1;
   XXXX.a_1 := e_1;
   e_1 := foo_f2(XXXX, XXXX, e_1, f_1);
   e_1 := foo_f2 (XXXX, XXXX);
-  e_1 := foo_f2 (c_1 => e_1, b_1 := XXXX, d_1 := 10, a_1 := XXXX);
+  e_1 := foo_f2 (c_1 => e_1, b_1 := XXXX, d_1 := 10.0, a_1 := XXXX);
   e_1 := foo_f2 (b_1 := XXXX);
 end_function_block