merging the Edouard's version.
authorMario de Sousa <msousa@fe.up.pt>
Tue, 05 Apr 2011 17:12:12 +0100
changeset 282 871edf12fe64
parent 281 686fa44e3832 (current diff)
parent 279 c0453b7f99df (diff)
child 283 214d3fdee596
merging the Edouard's version.
lib/create_standard_function_header.sh
lib/iec_std_lib.h
stage4/generate_c/generate_c_st.cc
--- a/Makefile	Tue Apr 05 14:24:07 2011 +0100
+++ b/Makefile	Tue Apr 05 17:12:12 2011 +0100
@@ -1,3 +1,21 @@
+# matiec - a compiler for the programming languages defined in IEC 61131-3
+#
+# Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+# Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
+#
+# 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/>.
+
 # include the system specific Makefile
 include Makefile.$(shell uname)
 
--- a/Makefile.CYGWIN_NT-5.1	Tue Apr 05 14:24:07 2011 +0100
+++ b/Makefile.CYGWIN_NT-5.1	Tue Apr 05 17:12:12 2011 +0100
@@ -1,4 +1,21 @@
-#CXX = i686-mingw32-c++ 
+# matiec - a compiler for the programming languages defined in IEC 61131-3
+#
+# Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+# Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
+#
+# 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/>.
+
 CXX = g++ -mno-cygwin
 
 #get warnings, debugging information and optimization
--- a/Makefile.CYGWIN_NT-6.0	Tue Apr 05 14:24:07 2011 +0100
+++ b/Makefile.CYGWIN_NT-6.0	Tue Apr 05 17:12:12 2011 +0100
@@ -1,3 +1,21 @@
+# matiec - a compiler for the programming languages defined in IEC 61131-3
+#
+# Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+# Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
+#
+# 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/>.
+
 #CXX = i686-mingw32-c++ 
 CXX = g++ -mno-cygwin
 
@@ -14,4 +32,4 @@
 #CXXFLAGS += -O3 -funroll-loops
 CXXFLAGS  = $(CFLAGS)
 
-IECLIBDIR=lib
\ No newline at end of file
+IECLIBDIR=lib
--- a/Makefile.Darwin	Tue Apr 05 14:24:07 2011 +0100
+++ b/Makefile.Darwin	Tue Apr 05 17:12:12 2011 +0100
@@ -1,4 +1,21 @@
-#CXX = i686-mingw32-c++ 
+# matiec - a compiler for the programming languages defined in IEC 61131-3
+#
+# Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+# Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
+#
+# 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/>.
+
 CXX = g++ 
 
 #get warnings, debugging information and optimization
--- a/Makefile.Linux	Tue Apr 05 14:24:07 2011 +0100
+++ b/Makefile.Linux	Tue Apr 05 17:12:12 2011 +0100
@@ -1,3 +1,21 @@
+# matiec - a compiler for the programming languages defined in IEC 61131-3
+#
+# Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+# Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
+#
+# 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/>.
+
 #CXX = i686-mingw32-c++ 
 CXX = g++ 
 
--- a/Makefile.MINGW32_NT-5.1	Tue Apr 05 14:24:07 2011 +0100
+++ b/Makefile.MINGW32_NT-5.1	Tue Apr 05 17:12:12 2011 +0100
@@ -1,3 +1,21 @@
+# matiec - a compiler for the programming languages defined in IEC 61131-3
+#
+# Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+# Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
+#
+# 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/>.
+
 #CXX = i686-mingw32-c++ 
 CXX = g++
 
@@ -14,4 +32,4 @@
 #CXXFLAGS += -O3 -funroll-loops
 CXXFLAGS  = $(CFLAGS)
 
-IECLIBDIR=lib
\ No newline at end of file
+IECLIBDIR=lib
--- a/absyntax/Makefile	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax/Makefile	Tue Apr 05 17:12:12 2011 +0100
@@ -1,3 +1,21 @@
+# matiec - a compiler for the programming languages defined in IEC 61131-3
+#
+# Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+# Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
+#
+# 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/>.
+
 # include the system specific Makefile
 include ../Makefile.$(shell uname)
 
--- a/absyntax/absyntax.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax/absyntax.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -1,6 +1,7 @@
 /*
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax/absyntax.def	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax/absyntax.def	Tue Apr 05 17:12:12 2011 +0100
@@ -1,6 +1,7 @@
 /*
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax/absyntax.hh	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax/absyntax.hh	Tue Apr 05 17:12:12 2011 +0100
@@ -1,6 +1,7 @@
 /*
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax/visitor.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax/visitor.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -1,6 +1,7 @@
 /*
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax/visitor.hh	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax/visitor.hh	Tue Apr 05 17:12:12 2011 +0100
@@ -1,6 +1,7 @@
 /*
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/Makefile	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/Makefile	Tue Apr 05 17:12:12 2011 +0100
@@ -1,9 +1,24 @@
+# matiec - a compiler for the programming languages defined in IEC 61131-3
+#
+# Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+# Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
+#
+# 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/>.
+
 # include the system specific Makefile
 include ../Makefile.$(shell uname)
 
-
-
-
 SEARCH_UTIL_FILES  = absyntax_utils.o
 SEARCH_UTIL_FILES += search_expression_type.o
 SEARCH_UTIL_FILES += decompose_var_instance_name.o
@@ -23,21 +38,15 @@
 SEARCH_UTIL_FILES += get_sizeof_datatype.o
 SEARCH_UTIL_FILES += get_function_type.o
 
-
 default: all
 
 all: $(SEARCH_UTIL_FILES)
 
-
-
 clean:
 	rm -f *.o Makefile.depend
 
-
 CXXFLAGS += -I. -I../*
 
-
-
 Makefile.depend depend:
 	$(CXX) -MM -MG -I. *.cc \
 	  | sed 's/:/ Makefile.depend:/' > Makefile.depend
--- a/absyntax_utils/absyntax_utils.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/absyntax_utils.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2009-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/absyntax_utils.hh	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/absyntax_utils.hh	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2009-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/add_en_eno_param_decl.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/add_en_eno_param_decl.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2009-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/add_en_eno_param_decl.hh	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/add_en_eno_param_decl.hh	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2009-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/decompose_var_instance_name.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/decompose_var_instance_name.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/decompose_var_instance_name.hh	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/decompose_var_instance_name.hh	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/function_call_iterator.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/function_call_iterator.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/function_call_iterator.hh	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/function_call_iterator.hh	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/function_call_param_iterator.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/function_call_param_iterator.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/function_call_param_iterator.hh	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/function_call_param_iterator.hh	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/function_param_iterator.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/function_param_iterator.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/function_param_iterator.hh	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/function_param_iterator.hh	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/function_type_decl.h	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/function_type_decl.h	Tue Apr 05 17:12:12 2011 +0100
@@ -1,32 +1,20 @@
 /*
- *  matiec - a compiler for the programming languages defined in IEC 61131-3
+ * Copyright (C) 2007-2011: Edouard TISSERANT and Laurent BESSARD
  *
- *  Copyright (C) 2008 Edouard TISSERANT
+ * See COPYING and COPYING.LESSER files for copyright 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 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.
+ * 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.
- *
- * Based on the
- * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
@@ -424,9 +412,19 @@
     function_acos,
     function_atan,
     function_add,
+    function_add_time,
+    function_add_tod_time,
+    function_add_dt_time,
     function_mul,
+    function_multime,
     function_sub,
+    function_sub_time,
+    function_sub_date_date,
+    function_sub_tod_time,
+    function_sub_tod_tod,
+    function_sub_dt_time,
     function_div,
+    function_divtime,
     function_mod,
     function_expt,
     function_move,
@@ -454,6 +452,7 @@
     function_right,
     function_mid,
     function_concat,
+    function_concat_dat_tod,
     function_insert,
     function_delete,
     function_replace,
--- a/absyntax_utils/get_function_type.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/get_function_type.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -1,7 +1,8 @@
 /*
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
- *  Copyright (C) 2008 Edouard TISSERANT
+ *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/get_function_type_decl.c	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/get_function_type_decl.c	Tue Apr 05 17:12:12 2011 +0100
@@ -1,32 +1,20 @@
 /*
- *  matiec - a compiler for the programming languages defined in IEC 61131-3
+ * Copyright (C) 2007-2011: Edouard TISSERANT and Laurent BESSARD
  *
- *  Copyright (C) 2008 Edouard TISSERANT
+ * See COPYING and COPYING.LESSER files for copyright 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 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.
+ * 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.
- *
- * Based on the
- * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
@@ -1199,15 +1187,45 @@
 if (!strcasecmp(function_name->value, "ADD"))
     return function_add;
 
+if (!strcasecmp(function_name->value, "ADD_TIME"))
+    return function_add_time;
+
+if (!strcasecmp(function_name->value, "ADD_TOD_TIME"))
+    return function_add_tod_time;
+
+if (!strcasecmp(function_name->value, "ADD_DT_TIME"))
+    return function_add_dt_time;
+
 if (!strcasecmp(function_name->value, "MUL"))
     return function_mul;
 
+if (!strcasecmp(function_name->value, "MULTIME"))
+    return function_multime;
+
 if (!strcasecmp(function_name->value, "SUB"))
     return function_sub;
 
+if (!strcasecmp(function_name->value, "SUB_TIME"))
+    return function_sub_time;
+
+if (!strcasecmp(function_name->value, "SUB_DATE_DATE"))
+    return function_sub_date_date;
+
+if (!strcasecmp(function_name->value, "SUB_TOD_TIME"))
+    return function_sub_tod_time;
+
+if (!strcasecmp(function_name->value, "SUB_TOD_TOD"))
+    return function_sub_tod_tod;
+
+if (!strcasecmp(function_name->value, "SUB_DT_TIME"))
+    return function_sub_dt_time;
+
 if (!strcasecmp(function_name->value, "DIV"))
     return function_div;
 
+if (!strcasecmp(function_name->value, "DIVTIME"))
+    return function_divtime;
+
 if (!strcasecmp(function_name->value, "MOD"))
     return function_mod;
 
@@ -1289,6 +1307,9 @@
 if (!strcasecmp(function_name->value, "CONCAT"))
     return function_concat;
 
+if (!strcasecmp(function_name->value, "CONCAT_DAT_TOD"))
+    return function_concat_dat_tod;
+
 if (!strcasecmp(function_name->value, "INSERT"))
     return function_insert;
 
--- a/absyntax_utils/get_sizeof_datatype.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/get_sizeof_datatype.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2009-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/get_sizeof_datatype.hh	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/get_sizeof_datatype.hh	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2009-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/search_base_type.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/search_base_type.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/search_base_type.hh	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/search_base_type.hh	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/search_constant_type.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/search_constant_type.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/search_constant_type.hh	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/search_constant_type.hh	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/search_expression_type.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/search_expression_type.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/search_expression_type.hh	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/search_expression_type.hh	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/search_fb_instance_decl.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/search_fb_instance_decl.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/search_fb_instance_decl.hh	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/search_fb_instance_decl.hh	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/search_fb_typedecl.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/search_fb_typedecl.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/search_fb_typedecl.hh	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/search_fb_typedecl.hh	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/search_il_operand_type.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/search_il_operand_type.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/search_il_operand_type.hh	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/search_il_operand_type.hh	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/search_type_code.c	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/search_type_code.c	Tue Apr 05 17:12:12 2011 +0100
@@ -1,31 +1,20 @@
 /*
- *  matiec - a compiler for the programming languages defined in IEC 61131-3
+ * Copyright (C) 2007-2011: Edouard TISSERANT and Laurent BESSARD
  *
- *  Copyright (C) 2008 Edouard TISSERANT
+ * See COPYING and COPYING.LESSER files for copyright 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 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.
+ * 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)
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
@@ -14103,9 +14092,9 @@
     break;
 
 /****
- *MUL
- */
-    case function_mul :
+ *ADD_TIME
+ */
+    case function_add_time :
     {
         symbol_c *last_type_symbol = NULL;
 
@@ -14123,7 +14112,7 @@
               last_type_symbol = last_type_symbol && IN1_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ;
             }
             
-            if(IN1_type_symbol == NULL || search_expression_type->is_num_type(IN1_type_symbol))
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
             {
         
                 {
@@ -14140,10 +14129,10 @@
                       last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
                     }
                     
-                    if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
                     {
                 
-                        symbol_c * return_type_symbol = last_type_symbol;
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
                         return return_type_symbol;
                         
                     }
@@ -14154,7 +14143,35 @@
                 
             }
             
-            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+            
+            ERROR;
+        }
+        
+    }/*function_add_time*/
+    break;
+
+/****
+ *ADD_TOD_TIME
+ */
+    case function_add_tod_time :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = function_call_param_iterator.search_f(IN1_param_name);
+            symbol_c *IN1_type_symbol = NULL;
+            
+            /* Get the value from a foo(<param_value>) style call */
+            if (IN1_param_value == NULL)
+              IN1_param_value = function_call_param_iterator.next_nf();
+            if (IN1_param_value != NULL) {
+              IN1_type_symbol = search_expression_type->get_type(IN1_param_value);
+              last_type_symbol = last_type_symbol && IN1_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ;
+            }
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
             {
         
                 {
@@ -14171,10 +14188,10 @@
                       last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
                     }
                     
-                    if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
                     {
                 
-                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name;
                         return return_type_symbol;
                         
                     }
@@ -14189,13 +14206,13 @@
             ERROR;
         }
         
-    }/*function_mul*/
-    break;
-
-/****
- *SUB
- */
-    case function_sub :
+    }/*function_add_tod_time*/
+    break;
+
+/****
+ *ADD_DT_TIME
+ */
+    case function_add_dt_time :
     {
         symbol_c *last_type_symbol = NULL;
 
@@ -14213,7 +14230,7 @@
               last_type_symbol = last_type_symbol && IN1_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ;
             }
             
-            if(IN1_type_symbol == NULL || search_expression_type->is_num_type(IN1_type_symbol))
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol))
             {
         
                 {
@@ -14230,10 +14247,10 @@
                       last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
                     }
                     
-                    if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
                     {
                 
-                        symbol_c * return_type_symbol = last_type_symbol;
+                        symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name;
                         return return_type_symbol;
                         
                     }
@@ -14244,7 +14261,35 @@
                 
             }
             
-            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol))
+            
+            ERROR;
+        }
+        
+    }/*function_add_dt_time*/
+    break;
+
+/****
+ *MUL
+ */
+    case function_mul :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = function_call_param_iterator.search_f(IN1_param_name);
+            symbol_c *IN1_type_symbol = NULL;
+            
+            /* Get the value from a foo(<param_value>) style call */
+            if (IN1_param_value == NULL)
+              IN1_param_value = function_call_param_iterator.next_nf();
+            if (IN1_param_value != NULL) {
+              IN1_type_symbol = search_expression_type->get_type(IN1_param_value);
+              last_type_symbol = last_type_symbol && IN1_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ;
+            }
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_num_type(IN1_type_symbol))
             {
         
                 {
@@ -14261,10 +14306,10 @@
                       last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
                     }
                     
-                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol))
+                    if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
                     {
                 
-                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        symbol_c * return_type_symbol = last_type_symbol;
                         return return_type_symbol;
                         
                     }
@@ -14275,7 +14320,7 @@
                 
             }
             
-            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol))
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
             {
         
                 {
@@ -14292,7 +14337,7 @@
                       last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
                     }
                     
-                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol))
+                    if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
                     {
                 
                         symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
@@ -14300,21 +14345,41 @@
                         
                     }
                     
-                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
-                    {
-                
-                        symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name;
-                        return return_type_symbol;
-                        
-                    }
-                    
                     
                     ERROR;
                 }
                 
             }
             
-            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
+            
+            ERROR;
+        }
+        
+    }/*function_mul*/
+    break;
+
+/****
+ *MULTIME
+ */
+    case function_multime :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = function_call_param_iterator.search_f(IN1_param_name);
+            symbol_c *IN1_type_symbol = NULL;
+            
+            /* Get the value from a foo(<param_value>) style call */
+            if (IN1_param_value == NULL)
+              IN1_param_value = function_call_param_iterator.next_nf();
+            if (IN1_param_value != NULL) {
+              IN1_type_symbol = search_expression_type->get_type(IN1_param_value);
+              last_type_symbol = last_type_symbol && IN1_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ;
+            }
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
             {
         
                 {
@@ -14331,7 +14396,7 @@
                       last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
                     }
                     
-                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
+                    if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
                     {
                 
                         symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
@@ -14339,21 +14404,41 @@
                         
                     }
                     
-                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
-                    {
-                
-                        symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name;
-                        return return_type_symbol;
-                        
-                    }
-                    
                     
                     ERROR;
                 }
                 
             }
             
-            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+            
+            ERROR;
+        }
+        
+    }/*function_multime*/
+    break;
+
+/****
+ *SUB
+ */
+    case function_sub :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = function_call_param_iterator.search_f(IN1_param_name);
+            symbol_c *IN1_type_symbol = NULL;
+            
+            /* Get the value from a foo(<param_value>) style call */
+            if (IN1_param_value == NULL)
+              IN1_param_value = function_call_param_iterator.next_nf();
+            if (IN1_param_value != NULL) {
+              IN1_type_symbol = search_expression_type->get_type(IN1_param_value);
+              last_type_symbol = last_type_symbol && IN1_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ;
+            }
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_num_type(IN1_type_symbol))
             {
         
                 {
@@ -14370,10 +14455,10 @@
                       last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
                     }
                     
-                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+                    if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
                     {
                 
-                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        symbol_c * return_type_symbol = last_type_symbol;
                         return return_type_symbol;
                         
                     }
@@ -14384,35 +14469,7 @@
                 
             }
             
-            
-            ERROR;
-        }
-        
-    }/*function_sub*/
-    break;
-
-/****
- *DIV
- */
-    case function_div :
-    {
-        symbol_c *last_type_symbol = NULL;
-
-        {
-            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
-            /* Get the value from a foo(<param_name> = <param_value>) style call */
-            symbol_c *IN1_param_value = function_call_param_iterator.search_f(IN1_param_name);
-            symbol_c *IN1_type_symbol = NULL;
-            
-            /* Get the value from a foo(<param_value>) style call */
-            if (IN1_param_value == NULL)
-              IN1_param_value = function_call_param_iterator.next_nf();
-            if (IN1_param_value != NULL) {
-              IN1_type_symbol = search_expression_type->get_type(IN1_param_value);
-              last_type_symbol = last_type_symbol && IN1_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ;
-            }
-            
-            if(IN1_type_symbol == NULL || search_expression_type->is_num_type(IN1_type_symbol))
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol))
             {
         
                 {
@@ -14429,10 +14486,10 @@
                       last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
                     }
                     
-                    if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol))
                     {
                 
-                        symbol_c * return_type_symbol = last_type_symbol;
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
                         return return_type_symbol;
                         
                     }
@@ -14443,7 +14500,7 @@
                 
             }
             
-            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol))
             {
         
                 {
@@ -14460,7 +14517,7 @@
                       last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
                     }
                     
-                    if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol))
                     {
                 
                         symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
@@ -14468,12 +14525,483 @@
                         
                     }
                     
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+                    {
+                
+                        symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name;
+                        return return_type_symbol;
+                        
+                    }
+                    
                     
                     ERROR;
                 }
                 
             }
             
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
+                    {
+                
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        return return_type_symbol;
+                        
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+                    {
+                
+                        symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name;
+                        return return_type_symbol;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+                    {
+                
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        return return_type_symbol;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_sub*/
+    break;
+
+/****
+ *SUB_TIME
+ */
+    case function_sub_time :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = function_call_param_iterator.search_f(IN1_param_name);
+            symbol_c *IN1_type_symbol = NULL;
+            
+            /* Get the value from a foo(<param_value>) style call */
+            if (IN1_param_value == NULL)
+              IN1_param_value = function_call_param_iterator.next_nf();
+            if (IN1_param_value != NULL) {
+              IN1_type_symbol = search_expression_type->get_type(IN1_param_value);
+              last_type_symbol = last_type_symbol && IN1_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ;
+            }
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+                    {
+                
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        return return_type_symbol;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_sub_time*/
+    break;
+
+/****
+ *SUB_DATE_DATE
+ */
+    case function_sub_date_date :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = function_call_param_iterator.search_f(IN1_param_name);
+            symbol_c *IN1_type_symbol = NULL;
+            
+            /* Get the value from a foo(<param_value>) style call */
+            if (IN1_param_value == NULL)
+              IN1_param_value = function_call_param_iterator.next_nf();
+            if (IN1_param_value != NULL) {
+              IN1_type_symbol = search_expression_type->get_type(IN1_param_value);
+              last_type_symbol = last_type_symbol && IN1_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ;
+            }
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol))
+                    {
+                
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        return return_type_symbol;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_sub_date_date*/
+    break;
+
+/****
+ *SUB_TOD_TIME
+ */
+    case function_sub_tod_time :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = function_call_param_iterator.search_f(IN1_param_name);
+            symbol_c *IN1_type_symbol = NULL;
+            
+            /* Get the value from a foo(<param_value>) style call */
+            if (IN1_param_value == NULL)
+              IN1_param_value = function_call_param_iterator.next_nf();
+            if (IN1_param_value != NULL) {
+              IN1_type_symbol = search_expression_type->get_type(IN1_param_value);
+              last_type_symbol = last_type_symbol && IN1_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ;
+            }
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+                    {
+                
+                        symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name;
+                        return return_type_symbol;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_sub_tod_time*/
+    break;
+
+/****
+ *SUB_TOD_TOD
+ */
+    case function_sub_tod_tod :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = function_call_param_iterator.search_f(IN1_param_name);
+            symbol_c *IN1_type_symbol = NULL;
+            
+            /* Get the value from a foo(<param_value>) style call */
+            if (IN1_param_value == NULL)
+              IN1_param_value = function_call_param_iterator.next_nf();
+            if (IN1_param_value != NULL) {
+              IN1_type_symbol = search_expression_type->get_type(IN1_param_value);
+              last_type_symbol = last_type_symbol && IN1_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ;
+            }
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
+                    {
+                
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        return return_type_symbol;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_sub_tod_tod*/
+    break;
+
+/****
+ *SUB_DT_TIME
+ */
+    case function_sub_dt_time :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = function_call_param_iterator.search_f(IN1_param_name);
+            symbol_c *IN1_type_symbol = NULL;
+            
+            /* Get the value from a foo(<param_value>) style call */
+            if (IN1_param_value == NULL)
+              IN1_param_value = function_call_param_iterator.next_nf();
+            if (IN1_param_value != NULL) {
+              IN1_type_symbol = search_expression_type->get_type(IN1_param_value);
+              last_type_symbol = last_type_symbol && IN1_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ;
+            }
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol))
+                    {
+                
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        return return_type_symbol;
+                        
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+                    {
+                
+                        symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name;
+                        return return_type_symbol;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_sub_dt_time*/
+    break;
+
+/****
+ *DIV
+ */
+    case function_div :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = function_call_param_iterator.search_f(IN1_param_name);
+            symbol_c *IN1_type_symbol = NULL;
+            
+            /* Get the value from a foo(<param_value>) style call */
+            if (IN1_param_value == NULL)
+              IN1_param_value = function_call_param_iterator.next_nf();
+            if (IN1_param_value != NULL) {
+              IN1_type_symbol = search_expression_type->get_type(IN1_param_value);
+              last_type_symbol = last_type_symbol && IN1_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ;
+            }
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_num_type(IN1_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
+                    {
+                
+                        symbol_c * return_type_symbol = last_type_symbol;
+                        return return_type_symbol;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
+                    {
+                
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        return return_type_symbol;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
             
             ERROR;
         }
@@ -14482,6 +15010,65 @@
     break;
 
 /****
+ *DIVTIME
+ */
+    case function_divtime :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = function_call_param_iterator.search_f(IN1_param_name);
+            symbol_c *IN1_type_symbol = NULL;
+            
+            /* Get the value from a foo(<param_value>) style call */
+            if (IN1_param_value == NULL)
+              IN1_param_value = function_call_param_iterator.next_nf();
+            if (IN1_param_value != NULL) {
+              IN1_type_symbol = search_expression_type->get_type(IN1_param_value);
+              last_type_symbol = last_type_symbol && IN1_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ;
+            }
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
+                    {
+                
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        return return_type_symbol;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_divtime*/
+    break;
+
+/****
  *MOD
  */
     case function_mod :
@@ -16059,7 +16646,7 @@
               last_type_symbol = last_type_symbol && IN1_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ;
             }
             
-            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol))
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol))
             {
         
                 {
@@ -16076,10 +16663,10 @@
                       last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
                     }
                     
-                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol))
                     {
                 
-                        symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name;
+                        symbol_c * return_type_symbol = &search_constant_type_c::string_type_name;
                         return return_type_symbol;
                         
                     }
@@ -16090,7 +16677,35 @@
                 
             }
             
-            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol))
+            
+            ERROR;
+        }
+        
+    }/*function_concat*/
+    break;
+
+/****
+ *CONCAT_DAT_TOD
+ */
+    case function_concat_dat_tod :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = function_call_param_iterator.search_f(IN1_param_name);
+            symbol_c *IN1_type_symbol = NULL;
+            
+            /* Get the value from a foo(<param_value>) style call */
+            if (IN1_param_value == NULL)
+              IN1_param_value = function_call_param_iterator.next_nf();
+            if (IN1_param_value != NULL) {
+              IN1_type_symbol = search_expression_type->get_type(IN1_param_value);
+              last_type_symbol = last_type_symbol && IN1_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ;
+            }
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol))
             {
         
                 {
@@ -16107,10 +16722,10 @@
                       last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
                     }
                     
-                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol))
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
                     {
                 
-                        symbol_c * return_type_symbol = &search_constant_type_c::string_type_name;
+                        symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name;
                         return return_type_symbol;
                         
                     }
@@ -16125,7 +16740,7 @@
             ERROR;
         }
         
-    }/*function_concat*/
+    }/*function_concat_dat_tod*/
     break;
 
 /****
@@ -26649,9 +27264,9 @@
     break;
 
 /****
- *MUL
- */
-    case function_mul :
+ *ADD_TIME
+ */
+    case function_add_time :
     {
         symbol_c *last_type_symbol = NULL;
 
@@ -26659,7 +27274,7 @@
             symbol_c *IN1_type_symbol = param_data_type;
             last_type_symbol = param_data_type;
             
-            if(IN1_type_symbol == NULL || search_expression_type->is_num_type(IN1_type_symbol))
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
             {
         
                 {
@@ -26676,10 +27291,10 @@
                       last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
                     }
                     
-                    if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
                     {
                 
-                        symbol_c * return_type_symbol = last_type_symbol;
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
                         return return_type_symbol;
                         
                     }
@@ -26690,7 +27305,25 @@
                 
             }
             
-            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+            
+            ERROR;
+        }
+        
+    }/*function_add_time*/
+    break;
+
+/****
+ *ADD_TOD_TIME
+ */
+    case function_add_tod_time :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_type_symbol = param_data_type;
+            last_type_symbol = param_data_type;
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
             {
         
                 {
@@ -26707,10 +27340,10 @@
                       last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
                     }
                     
-                    if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
                     {
                 
-                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name;
                         return return_type_symbol;
                         
                     }
@@ -26725,13 +27358,13 @@
             ERROR;
         }
         
-    }/*function_mul*/
-    break;
-
-/****
- *SUB
- */
-    case function_sub :
+    }/*function_add_tod_time*/
+    break;
+
+/****
+ *ADD_DT_TIME
+ */
+    case function_add_dt_time :
     {
         symbol_c *last_type_symbol = NULL;
 
@@ -26739,7 +27372,7 @@
             symbol_c *IN1_type_symbol = param_data_type;
             last_type_symbol = param_data_type;
             
-            if(IN1_type_symbol == NULL || search_expression_type->is_num_type(IN1_type_symbol))
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol))
             {
         
                 {
@@ -26756,10 +27389,10 @@
                       last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
                     }
                     
-                    if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
                     {
                 
-                        symbol_c * return_type_symbol = last_type_symbol;
+                        symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name;
                         return return_type_symbol;
                         
                     }
@@ -26770,7 +27403,25 @@
                 
             }
             
-            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol))
+            
+            ERROR;
+        }
+        
+    }/*function_add_dt_time*/
+    break;
+
+/****
+ *MUL
+ */
+    case function_mul :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_type_symbol = param_data_type;
+            last_type_symbol = param_data_type;
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_num_type(IN1_type_symbol))
             {
         
                 {
@@ -26787,10 +27438,10 @@
                       last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
                     }
                     
-                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol))
+                    if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
                     {
                 
-                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        symbol_c * return_type_symbol = last_type_symbol;
                         return return_type_symbol;
                         
                     }
@@ -26801,7 +27452,7 @@
                 
             }
             
-            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol))
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
             {
         
                 {
@@ -26818,7 +27469,7 @@
                       last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
                     }
                     
-                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol))
+                    if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
                     {
                 
                         symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
@@ -26826,21 +27477,31 @@
                         
                     }
                     
-                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
-                    {
-                
-                        symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name;
-                        return return_type_symbol;
-                        
-                    }
-                    
                     
                     ERROR;
                 }
                 
             }
             
-            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
+            
+            ERROR;
+        }
+        
+    }/*function_mul*/
+    break;
+
+/****
+ *MULTIME
+ */
+    case function_multime :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_type_symbol = param_data_type;
+            last_type_symbol = param_data_type;
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
             {
         
                 {
@@ -26857,7 +27518,7 @@
                       last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
                     }
                     
-                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
+                    if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
                     {
                 
                         symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
@@ -26865,21 +27526,31 @@
                         
                     }
                     
-                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
-                    {
-                
-                        symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name;
-                        return return_type_symbol;
-                        
-                    }
-                    
                     
                     ERROR;
                 }
                 
             }
             
-            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+            
+            ERROR;
+        }
+        
+    }/*function_multime*/
+    break;
+
+/****
+ *SUB
+ */
+    case function_sub :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_type_symbol = param_data_type;
+            last_type_symbol = param_data_type;
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_num_type(IN1_type_symbol))
             {
         
                 {
@@ -26896,10 +27567,10 @@
                       last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
                     }
                     
-                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+                    if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
                     {
                 
-                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        symbol_c * return_type_symbol = last_type_symbol;
                         return return_type_symbol;
                         
                     }
@@ -26910,25 +27581,7 @@
                 
             }
             
-            
-            ERROR;
-        }
-        
-    }/*function_sub*/
-    break;
-
-/****
- *DIV
- */
-    case function_div :
-    {
-        symbol_c *last_type_symbol = NULL;
-
-        {
-            symbol_c *IN1_type_symbol = param_data_type;
-            last_type_symbol = param_data_type;
-            
-            if(IN1_type_symbol == NULL || search_expression_type->is_num_type(IN1_type_symbol))
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol))
             {
         
                 {
@@ -26945,10 +27598,10 @@
                       last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
                     }
                     
-                    if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol))
                     {
                 
-                        symbol_c * return_type_symbol = last_type_symbol;
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
                         return return_type_symbol;
                         
                     }
@@ -26959,7 +27612,7 @@
                 
             }
             
-            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol))
             {
         
                 {
@@ -26976,7 +27629,7 @@
                       last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
                     }
                     
-                    if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol))
                     {
                 
                         symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
@@ -26984,12 +27637,423 @@
                         
                     }
                     
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+                    {
+                
+                        symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name;
+                        return return_type_symbol;
+                        
+                    }
+                    
                     
                     ERROR;
                 }
                 
             }
             
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
+                    {
+                
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        return return_type_symbol;
+                        
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+                    {
+                
+                        symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name;
+                        return return_type_symbol;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+                    {
+                
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        return return_type_symbol;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_sub*/
+    break;
+
+/****
+ *SUB_TIME
+ */
+    case function_sub_time :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_type_symbol = param_data_type;
+            last_type_symbol = param_data_type;
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+                    {
+                
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        return return_type_symbol;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_sub_time*/
+    break;
+
+/****
+ *SUB_DATE_DATE
+ */
+    case function_sub_date_date :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_type_symbol = param_data_type;
+            last_type_symbol = param_data_type;
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol))
+                    {
+                
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        return return_type_symbol;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_sub_date_date*/
+    break;
+
+/****
+ *SUB_TOD_TIME
+ */
+    case function_sub_tod_time :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_type_symbol = param_data_type;
+            last_type_symbol = param_data_type;
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+                    {
+                
+                        symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name;
+                        return return_type_symbol;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_sub_tod_time*/
+    break;
+
+/****
+ *SUB_TOD_TOD
+ */
+    case function_sub_tod_tod :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_type_symbol = param_data_type;
+            last_type_symbol = param_data_type;
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
+                    {
+                
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        return return_type_symbol;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_sub_tod_tod*/
+    break;
+
+/****
+ *SUB_DT_TIME
+ */
+    case function_sub_dt_time :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_type_symbol = param_data_type;
+            last_type_symbol = param_data_type;
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol))
+                    {
+                
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        return return_type_symbol;
+                        
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+                    {
+                
+                        symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name;
+                        return return_type_symbol;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_sub_dt_time*/
+    break;
+
+/****
+ *DIV
+ */
+    case function_div :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_type_symbol = param_data_type;
+            last_type_symbol = param_data_type;
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_num_type(IN1_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
+                    {
+                
+                        symbol_c * return_type_symbol = last_type_symbol;
+                        return return_type_symbol;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
+                    {
+                
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        return return_type_symbol;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
             
             ERROR;
         }
@@ -26998,6 +28062,55 @@
     break;
 
 /****
+ *DIVTIME
+ */
+    case function_divtime :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_type_symbol = param_data_type;
+            last_type_symbol = param_data_type;
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
+                    {
+                
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        return return_type_symbol;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_divtime*/
+    break;
+
+/****
  *MOD
  */
     case function_mod :
@@ -28305,7 +29418,7 @@
             symbol_c *IN1_type_symbol = param_data_type;
             last_type_symbol = param_data_type;
             
-            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol))
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol))
             {
         
                 {
@@ -28322,10 +29435,10 @@
                       last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
                     }
                     
-                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol))
                     {
                 
-                        symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name;
+                        symbol_c * return_type_symbol = &search_constant_type_c::string_type_name;
                         return return_type_symbol;
                         
                     }
@@ -28336,7 +29449,25 @@
                 
             }
             
-            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol))
+            
+            ERROR;
+        }
+        
+    }/*function_concat*/
+    break;
+
+/****
+ *CONCAT_DAT_TOD
+ */
+    case function_concat_dat_tod :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_type_symbol = param_data_type;
+            last_type_symbol = param_data_type;
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol))
             {
         
                 {
@@ -28353,10 +29484,10 @@
                       last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
                     }
                     
-                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol))
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
                     {
                 
-                        symbol_c * return_type_symbol = &search_constant_type_c::string_type_name;
+                        symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name;
                         return return_type_symbol;
                         
                     }
@@ -28371,7 +29502,7 @@
             ERROR;
         }
         
-    }/*function_concat*/
+    }/*function_concat_dat_tod*/
     break;
 
 /****
--- a/absyntax_utils/search_var_instance_decl.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/search_var_instance_decl.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/search_var_instance_decl.hh	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/search_var_instance_decl.hh	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/search_varfb_instance_type.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/search_varfb_instance_type.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/search_varfb_instance_type.hh	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/search_varfb_instance_type.hh	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/spec_init_separator.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/spec_init_separator.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/spec_init_separator.hh	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/spec_init_separator.hh	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/type_initial_value.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/type_initial_value.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/absyntax_utils/type_initial_value.hh	Tue Apr 05 14:24:07 2011 +0100
+++ b/absyntax_utils/type_initial_value.hh	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/lib/create_standard_function_header.sh	Tue Apr 05 14:24:07 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,631 +0,0 @@
-#!/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
-#
-
-
-print_usage()
-{
-  echo "usage: $0 {c | iec}"
-  echo "   c -> produce c file with implementation of standard functions"
-  echo " iec -> produce txt file with declaration of standard functions"
-  exit 0
-}
-
-
-create_iec_beg()
-{
-echo
-echo {disable code generation}
-echo
-}
-
-
-create_iec_end()
-{
-echo
-echo {enable code generation}
-echo
-}
-
-
-create_iec()
-{
-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
-}
-
-
-create_c_beg()
-{
-echo  
-}
-
-create_c_end()
-{
-echo  
-}
-
-
-create_c()
-{
-echo 
-echo inline
-echo $1"("$2 IN, $3 *__OUT, BOOL EN, BOOL *__ENO")" 
-echo { $4 }
-} 
- 
-
-##################################
-##################################
-##                              ##
-##    Main code starts here...  ##
-##                              ##
-##################################
-##################################
-
-if [ $# -ne 1 ] 
-then
-  print_usage
-fi
-
-if   [ $1 = "c" ] 
-then
-  create=create_c
-  create_beg=create_c_beg
-  create_end=create_c_end
-elif [ $1 = "iec" ] 
-then 
-  create=create_iec
-  create_beg=create_iec_beg
-  create_end=create_iec_end
-else
-  print_usage
-fi
-
-
-
-$create_beg    
-
-
-
-$create	BOOL_TO_BYTE	BOOL	BYTE	"*__OUT=(BYTE	)__move_BOOL	(EN,__ENO,IN);"	
-$create	BOOL_TO_DINT	BOOL	DINT	"*__OUT=(DINT	)__move_BOOL	(EN,__ENO,IN);"	
-$create	BOOL_TO_DWORD	BOOL	DWORD	"*__OUT=(DWORD	)__move_BOOL	(EN,__ENO,IN);"	
-$create	BOOL_TO_INT	BOOL	INT	"*__OUT=(INT	)__move_BOOL	(EN,__ENO,IN);"	
-$create	BOOL_TO_LINT	BOOL	LINT	"*__OUT=(LINT	)__move_BOOL	(EN,__ENO,IN);"	
-$create	BOOL_TO_LREAL	BOOL	LREAL	"*__OUT=(LREAL	)__move_BOOL	(EN,__ENO,IN);"	
-$create	BOOL_TO_LWORD	BOOL	LWORD	"*__OUT=(LWORD	)__move_BOOL	(EN,__ENO,IN);"	
-$create	BOOL_TO_REAL	BOOL	REAL	"*__OUT=(REAL	)__move_BOOL	(EN,__ENO,IN);"	
-$create	BOOL_TO_SINT	BOOL	SINT	"*__OUT=(SINT	)__move_BOOL	(EN,__ENO,IN);"	
-$create	BOOL_TO_UDINT	BOOL	UDINT	"*__OUT=(UDINT	)__move_BOOL	(EN,__ENO,IN);"	
-$create	BOOL_TO_UINT	BOOL	UINT	"*__OUT=(UINT	)__move_BOOL	(EN,__ENO,IN);"	
-$create	BOOL_TO_ULINT	BOOL	ULINT	"*__OUT=(ULINT	)__move_BOOL	(EN,__ENO,IN);"	
-$create	BOOL_TO_USINT	BOOL	USINT	"*__OUT=(USINT	)__move_BOOL	(EN,__ENO,IN);"	
-$create	BOOL_TO_WORD	BOOL	WORD	"*__OUT=(WORD	)__move_BOOL	(EN,__ENO,IN);"	
-$create	BYTE_TO_BOOL	BYTE	BOOL	"*__OUT=(BOOL	)__move_BYTE	(EN,__ENO,IN);"	
-$create	BYTE_TO_DINT	BYTE	DINT	"*__OUT=(DINT	)__move_BYTE	(EN,__ENO,IN);"	
-$create	BYTE_TO_DWORD	BYTE	DWORD	"*__OUT=(DWORD	)__move_BYTE	(EN,__ENO,IN);"	
-$create	BYTE_TO_INT	BYTE	INT	"*__OUT=(INT	)__move_BYTE	(EN,__ENO,IN);"	
-$create	BYTE_TO_LINT	BYTE	LINT	"*__OUT=(LINT	)__move_BYTE	(EN,__ENO,IN);"	
-$create	BYTE_TO_LREAL	BYTE	LREAL	"*__OUT=(LREAL	)__move_BYTE	(EN,__ENO,IN);"	
-$create	BYTE_TO_LWORD	BYTE	LWORD	"*__OUT=(LWORD	)__move_BYTE	(EN,__ENO,IN);"	
-$create	BYTE_TO_REAL	BYTE	REAL	"*__OUT=(REAL	)__move_BYTE	(EN,__ENO,IN);"	
-$create	BYTE_TO_SINT	BYTE	SINT	"*__OUT=(SINT	)__move_BYTE	(EN,__ENO,IN);"	
-$create	BYTE_TO_UDINT	BYTE	UDINT	"*__OUT=(UDINT	)__move_BYTE	(EN,__ENO,IN);"	
-$create	BYTE_TO_UINT	BYTE	UINT	"*__OUT=(UINT	)__move_BYTE	(EN,__ENO,IN);"	
-$create	BYTE_TO_ULINT	BYTE	ULINT	"*__OUT=(ULINT	)__move_BYTE	(EN,__ENO,IN);"	
-$create	BYTE_TO_USINT	BYTE	USINT	"*__OUT=(USINT	)__move_BYTE	(EN,__ENO,IN);"	
-$create	BYTE_TO_WORD	BYTE	WORD	"*__OUT=(WORD	)__move_BYTE	(EN,__ENO,IN);"	
-$create	DINT_TO_BOOL	DINT	BOOL	"*__OUT=(BOOL	)__move_DINT	(EN,__ENO,IN);"	
-$create	DINT_TO_BYTE	DINT	BYTE	"*__OUT=(BYTE	)__move_DINT	(EN,__ENO,IN);"	
-$create	DINT_TO_DWORD	DINT	DWORD	"*__OUT=(DWORD	)__move_DINT	(EN,__ENO,IN);"	
-$create	DINT_TO_INT	DINT	INT	"*__OUT=(INT	)__move_DINT	(EN,__ENO,IN);"	
-$create	DINT_TO_LINT	DINT	LINT	"*__OUT=(LINT	)__move_DINT	(EN,__ENO,IN);"	
-$create	DINT_TO_LREAL	DINT	LREAL	"*__OUT=(LREAL	)__move_DINT	(EN,__ENO,IN);"	
-$create	DINT_TO_LWORD	DINT	LWORD	"*__OUT=(LWORD	)__move_DINT	(EN,__ENO,IN);"	
-$create	DINT_TO_REAL	DINT	REAL	"*__OUT=(REAL	)__move_DINT	(EN,__ENO,IN);"	
-$create	DINT_TO_SINT	DINT	SINT	"*__OUT=(SINT	)__move_DINT	(EN,__ENO,IN);"	
-$create	DINT_TO_UDINT	DINT	UDINT	"*__OUT=(UDINT	)__move_DINT	(EN,__ENO,IN);"	
-$create	DINT_TO_UINT	DINT	UINT	"*__OUT=(UINT	)__move_DINT	(EN,__ENO,IN);"	
-$create	DINT_TO_ULINT	DINT	ULINT	"*__OUT=(ULINT	)__move_DINT	(EN,__ENO,IN);"	
-$create	DINT_TO_USINT	DINT	USINT	"*__OUT=(USINT	)__move_DINT	(EN,__ENO,IN);"	
-$create	DINT_TO_WORD	DINT	WORD	"*__OUT=(WORD	)__move_DINT	(EN,__ENO,IN);"	
-$create	DWORD_TO_BOOL	DWORD	BOOL	"*__OUT=(BOOL	)__move_DWORD	(EN,__ENO,IN);"	
-$create	DWORD_TO_BYTE	DWORD	BYTE	"*__OUT=(BYTE	)__move_DWORD	(EN,__ENO,IN);"	
-$create	DWORD_TO_DINT	DWORD	DINT	"*__OUT=(DINT	)__move_DWORD	(EN,__ENO,IN);"	
-$create	DWORD_TO_INT	DWORD	INT	"*__OUT=(INT	)__move_DWORD	(EN,__ENO,IN);"	
-$create	DWORD_TO_LINT	DWORD	LINT	"*__OUT=(LINT	)__move_DWORD	(EN,__ENO,IN);"	
-$create	DWORD_TO_LREAL	DWORD	LREAL	"*__OUT=(LREAL	)__move_DWORD	(EN,__ENO,IN);"	
-$create	DWORD_TO_LWORD	DWORD	LWORD	"*__OUT=(LWORD	)__move_DWORD	(EN,__ENO,IN);"	
-$create	DWORD_TO_REAL	DWORD	REAL	"*__OUT=(REAL	)__move_DWORD	(EN,__ENO,IN);"	
-$create	DWORD_TO_SINT	DWORD	SINT	"*__OUT=(SINT	)__move_DWORD	(EN,__ENO,IN);"	
-$create	DWORD_TO_UDINT	DWORD	UDINT	"*__OUT=(UDINT	)__move_DWORD	(EN,__ENO,IN);"	
-$create	DWORD_TO_UINT	DWORD	UINT	"*__OUT=(UINT	)__move_DWORD	(EN,__ENO,IN);"	
-$create	DWORD_TO_ULINT	DWORD	ULINT	"*__OUT=(ULINT	)__move_DWORD	(EN,__ENO,IN);"	
-$create	DWORD_TO_USINT	DWORD	USINT	"*__OUT=(USINT	)__move_DWORD	(EN,__ENO,IN);"	
-$create	DWORD_TO_WORD	DWORD	WORD	"*__OUT=(WORD	)__move_DWORD	(EN,__ENO,IN);"	
-$create	INT_TO_BOOL	INT	BOOL	"*__OUT=(BOOL	)__move_INT	(EN,__ENO,IN);"	
-$create	INT_TO_BYTE	INT	BYTE	"*__OUT=(BYTE	)__move_INT	(EN,__ENO,IN);"	
-$create	INT_TO_DINT	INT	DINT	"*__OUT=(DINT	)__move_INT	(EN,__ENO,IN);"	
-$create	INT_TO_DWORD	INT	DWORD	"*__OUT=(DWORD	)__move_INT	(EN,__ENO,IN);"	
-$create	INT_TO_LINT	INT	LINT	"*__OUT=(LINT	)__move_INT	(EN,__ENO,IN);"	
-$create	INT_TO_LREAL	INT	LREAL	"*__OUT=(LREAL	)__move_INT	(EN,__ENO,IN);"	
-$create	INT_TO_LWORD	INT	LWORD	"*__OUT=(LWORD	)__move_INT	(EN,__ENO,IN);"	
-$create	INT_TO_REAL	INT	REAL	"*__OUT=(REAL	)__move_INT	(EN,__ENO,IN);"	
-$create	INT_TO_SINT	INT	SINT	"*__OUT=(SINT	)__move_INT	(EN,__ENO,IN);"	
-$create	INT_TO_UDINT	INT	UDINT	"*__OUT=(UDINT	)__move_INT	(EN,__ENO,IN);"	
-$create	INT_TO_UINT	INT	UINT	"*__OUT=(UINT	)__move_INT	(EN,__ENO,IN);"	
-$create	INT_TO_ULINT	INT	ULINT	"*__OUT=(ULINT	)__move_INT	(EN,__ENO,IN);"	
-$create	INT_TO_USINT	INT	USINT	"*__OUT=(USINT	)__move_INT	(EN,__ENO,IN);"	
-$create	INT_TO_WORD	INT	WORD	"*__OUT=(WORD	)__move_INT	(EN,__ENO,IN);"	
-$create	LINT_TO_BOOL	LINT	BOOL	"*__OUT=(BOOL	)__move_LINT	(EN,__ENO,IN);"	
-$create	LINT_TO_BYTE	LINT	BYTE	"*__OUT=(BYTE	)__move_LINT	(EN,__ENO,IN);"	
-$create	LINT_TO_DINT	LINT	DINT	"*__OUT=(DINT	)__move_LINT	(EN,__ENO,IN);"	
-$create	LINT_TO_DWORD	LINT	DWORD	"*__OUT=(DWORD	)__move_LINT	(EN,__ENO,IN);"	
-$create	LINT_TO_INT	LINT	INT	"*__OUT=(INT	)__move_LINT	(EN,__ENO,IN);"	
-$create	LINT_TO_LREAL	LINT	LREAL	"*__OUT=(LREAL	)__move_LINT	(EN,__ENO,IN);"	
-$create	LINT_TO_LWORD	LINT	LWORD	"*__OUT=(LWORD	)__move_LINT	(EN,__ENO,IN);"	
-$create	LINT_TO_REAL	LINT	REAL	"*__OUT=(REAL	)__move_LINT	(EN,__ENO,IN);"	
-$create	LINT_TO_SINT	LINT	SINT	"*__OUT=(SINT	)__move_LINT	(EN,__ENO,IN);"	
-$create	LINT_TO_UDINT	LINT	UDINT	"*__OUT=(UDINT	)__move_LINT	(EN,__ENO,IN);"	
-$create	LINT_TO_UINT	LINT	UINT	"*__OUT=(UINT	)__move_LINT	(EN,__ENO,IN);"	
-$create	LINT_TO_ULINT	LINT	ULINT	"*__OUT=(ULINT	)__move_LINT	(EN,__ENO,IN);"	
-$create	LINT_TO_USINT	LINT	USINT	"*__OUT=(USINT	)__move_LINT	(EN,__ENO,IN);"	
-$create	LINT_TO_WORD	LINT	WORD	"*__OUT=(WORD	)__move_LINT	(EN,__ENO,IN);"	
-$create	LREAL_TO_BOOL	LREAL	BOOL	"*__OUT=(BOOL	)__move_LREAL	(EN,__ENO,IN);"	
-$create	LREAL_TO_BYTE	LREAL	BYTE	"*__OUT=(BYTE	)__move_LREAL	(EN,__ENO,IN);"	
-$create	LREAL_TO_DINT	LREAL	DINT	"*__OUT=(DINT	)__move_LREAL	(EN,__ENO,IN);"	
-$create	LREAL_TO_DWORD	LREAL	DWORD	"*__OUT=(DWORD	)__move_LREAL	(EN,__ENO,IN);"	
-$create	LREAL_TO_INT	LREAL	INT	"*__OUT=(INT	)__move_LREAL	(EN,__ENO,IN);"	
-$create	LREAL_TO_LINT	LREAL	LINT	"*__OUT=(LINT	)__move_LREAL	(EN,__ENO,IN);"	
-$create	LREAL_TO_LWORD	LREAL	LWORD	"*__OUT=(LWORD	)__move_LREAL	(EN,__ENO,IN);"	
-$create	LREAL_TO_REAL	LREAL	REAL	"*__OUT=(REAL	)__move_LREAL	(EN,__ENO,IN);"	
-$create	LREAL_TO_SINT	LREAL	SINT	"*__OUT=(SINT	)__move_LREAL	(EN,__ENO,IN);"	
-$create	LREAL_TO_UDINT	LREAL	UDINT	"*__OUT=(UDINT	)__move_LREAL	(EN,__ENO,IN);"	
-$create	LREAL_TO_UINT	LREAL	UINT	"*__OUT=(UINT	)__move_LREAL	(EN,__ENO,IN);"	
-$create	LREAL_TO_ULINT	LREAL	ULINT	"*__OUT=(ULINT	)__move_LREAL	(EN,__ENO,IN);"	
-$create	LREAL_TO_USINT	LREAL	USINT	"*__OUT=(USINT	)__move_LREAL	(EN,__ENO,IN);"	
-$create	LREAL_TO_WORD	LREAL	WORD	"*__OUT=(WORD	)__move_LREAL	(EN,__ENO,IN);"	
-$create	LWORD_TO_BOOL	LWORD	BOOL	"*__OUT=(BOOL	)__move_LWORD	(EN,__ENO,IN);"	
-$create	LWORD_TO_BYTE	LWORD	BYTE	"*__OUT=(BYTE	)__move_LWORD	(EN,__ENO,IN);"	
-$create	LWORD_TO_DINT	LWORD	DINT	"*__OUT=(DINT	)__move_LWORD	(EN,__ENO,IN);"	
-$create	LWORD_TO_DWORD	LWORD	DWORD	"*__OUT=(DWORD	)__move_LWORD	(EN,__ENO,IN);"	
-$create	LWORD_TO_INT	LWORD	INT	"*__OUT=(INT	)__move_LWORD	(EN,__ENO,IN);"	
-$create	LWORD_TO_LINT	LWORD	LINT	"*__OUT=(LINT	)__move_LWORD	(EN,__ENO,IN);"	
-$create	LWORD_TO_LREAL	LWORD	LREAL	"*__OUT=(LREAL	)__move_LWORD	(EN,__ENO,IN);"	
-$create	LWORD_TO_REAL	LWORD	REAL	"*__OUT=(REAL	)__move_LWORD	(EN,__ENO,IN);"	
-$create	LWORD_TO_SINT	LWORD	SINT	"*__OUT=(SINT	)__move_LWORD	(EN,__ENO,IN);"	
-$create	LWORD_TO_UDINT	LWORD	UDINT	"*__OUT=(UDINT	)__move_LWORD	(EN,__ENO,IN);"	
-$create	LWORD_TO_UINT	LWORD	UINT	"*__OUT=(UINT	)__move_LWORD	(EN,__ENO,IN);"	
-$create	LWORD_TO_ULINT	LWORD	ULINT	"*__OUT=(ULINT	)__move_LWORD	(EN,__ENO,IN);"	
-$create	LWORD_TO_USINT	LWORD	USINT	"*__OUT=(USINT	)__move_LWORD	(EN,__ENO,IN);"	
-$create	LWORD_TO_WORD	LWORD	WORD	"*__OUT=(WORD	)__move_LWORD	(EN,__ENO,IN);"	
-$create	REAL_TO_BOOL	REAL	BOOL	"*__OUT=(BOOL	)__move_REAL	(EN,__ENO,IN);"	
-$create	REAL_TO_BYTE	REAL	BYTE	"*__OUT=(BYTE	)__move_REAL	(EN,__ENO,IN);"	
-$create	REAL_TO_DINT	REAL	DINT	"*__OUT=(DINT	)__move_REAL	(EN,__ENO,IN);"	
-$create	REAL_TO_DWORD	REAL	DWORD	"*__OUT=(DWORD	)__move_REAL	(EN,__ENO,IN);"	
-$create	REAL_TO_INT	REAL	INT	"*__OUT=(INT	)__move_REAL	(EN,__ENO,IN);"	
-$create	REAL_TO_LINT	REAL	LINT	"*__OUT=(LINT	)__move_REAL	(EN,__ENO,IN);"	
-$create	REAL_TO_LREAL	REAL	LREAL	"*__OUT=(LREAL	)__move_REAL	(EN,__ENO,IN);"	
-$create	REAL_TO_LWORD	REAL	LWORD	"*__OUT=(LWORD	)__move_REAL	(EN,__ENO,IN);"	
-$create	REAL_TO_SINT	REAL	SINT	"*__OUT=(SINT	)__move_REAL	(EN,__ENO,IN);"	
-$create	REAL_TO_UDINT	REAL	UDINT	"*__OUT=(UDINT	)__move_REAL	(EN,__ENO,IN);"	
-$create	REAL_TO_UINT	REAL	UINT	"*__OUT=(UINT	)__move_REAL	(EN,__ENO,IN);"	
-$create	REAL_TO_ULINT	REAL	ULINT	"*__OUT=(ULINT	)__move_REAL	(EN,__ENO,IN);"	
-$create	REAL_TO_USINT	REAL	USINT	"*__OUT=(USINT	)__move_REAL	(EN,__ENO,IN);"	
-$create	REAL_TO_WORD	REAL	WORD	"*__OUT=(WORD	)__move_REAL	(EN,__ENO,IN);"	
-$create	SINT_TO_BOOL	SINT	BOOL	"*__OUT=(BOOL	)__move_SINT	(EN,__ENO,IN);"	
-$create	SINT_TO_BYTE	SINT	BYTE	"*__OUT=(BYTE	)__move_SINT	(EN,__ENO,IN);"	
-$create	SINT_TO_DINT	SINT	DINT	"*__OUT=(DINT	)__move_SINT	(EN,__ENO,IN);"	
-$create	SINT_TO_DWORD	SINT	DWORD	"*__OUT=(DWORD	)__move_SINT	(EN,__ENO,IN);"	
-$create	SINT_TO_INT	SINT	INT	"*__OUT=(INT	)__move_SINT	(EN,__ENO,IN);"	
-$create	SINT_TO_LINT	SINT	LINT	"*__OUT=(LINT	)__move_SINT	(EN,__ENO,IN);"	
-$create	SINT_TO_LREAL	SINT	LREAL	"*__OUT=(LREAL	)__move_SINT	(EN,__ENO,IN);"	
-$create	SINT_TO_LWORD	SINT	LWORD	"*__OUT=(LWORD	)__move_SINT	(EN,__ENO,IN);"	
-$create	SINT_TO_REAL	SINT	REAL	"*__OUT=(REAL	)__move_SINT	(EN,__ENO,IN);"	
-$create	SINT_TO_UDINT	SINT	UDINT	"*__OUT=(UDINT	)__move_SINT	(EN,__ENO,IN);"	
-$create	SINT_TO_UINT	SINT	UINT	"*__OUT=(UINT	)__move_SINT	(EN,__ENO,IN);"	
-$create	SINT_TO_ULINT	SINT	ULINT	"*__OUT=(ULINT	)__move_SINT	(EN,__ENO,IN);"	
-$create	SINT_TO_USINT	SINT	USINT	"*__OUT=(USINT	)__move_SINT	(EN,__ENO,IN);"	
-$create	SINT_TO_WORD	SINT	WORD	"*__OUT=(WORD	)__move_SINT	(EN,__ENO,IN);"	
-$create	UDINT_TO_BOOL	UDINT	BOOL	"*__OUT=(BOOL	)__move_UDINT	(EN,__ENO,IN);"	
-$create	UDINT_TO_BYTE	UDINT	BYTE	"*__OUT=(BYTE	)__move_UDINT	(EN,__ENO,IN);"	
-$create	UDINT_TO_DINT	UDINT	DINT	"*__OUT=(DINT	)__move_UDINT	(EN,__ENO,IN);"	
-$create	UDINT_TO_DWORD	UDINT	DWORD	"*__OUT=(DWORD	)__move_UDINT	(EN,__ENO,IN);"	
-$create	UDINT_TO_INT	UDINT	INT	"*__OUT=(INT	)__move_UDINT	(EN,__ENO,IN);"	
-$create	UDINT_TO_LINT	UDINT	LINT	"*__OUT=(LINT	)__move_UDINT	(EN,__ENO,IN);"	
-$create	UDINT_TO_LREAL	UDINT	LREAL	"*__OUT=(LREAL	)__move_UDINT	(EN,__ENO,IN);"	
-$create	UDINT_TO_LWORD	UDINT	LWORD	"*__OUT=(LWORD	)__move_UDINT	(EN,__ENO,IN);"	
-$create	UDINT_TO_REAL	UDINT	REAL	"*__OUT=(REAL	)__move_UDINT	(EN,__ENO,IN);"	
-$create	UDINT_TO_SINT	UDINT	SINT	"*__OUT=(SINT	)__move_UDINT	(EN,__ENO,IN);"	
-$create	UDINT_TO_UINT	UDINT	UINT	"*__OUT=(UINT	)__move_UDINT	(EN,__ENO,IN);"	
-$create	UDINT_TO_ULINT	UDINT	ULINT	"*__OUT=(ULINT	)__move_UDINT	(EN,__ENO,IN);"	
-$create	UDINT_TO_USINT	UDINT	USINT	"*__OUT=(USINT	)__move_UDINT	(EN,__ENO,IN);"	
-$create	UDINT_TO_WORD	UDINT	WORD	"*__OUT=(WORD	)__move_UDINT	(EN,__ENO,IN);"	
-$create	UINT_TO_BOOL	UINT	BOOL	"*__OUT=(BOOL	)__move_UINT	(EN,__ENO,IN);"	
-$create	UINT_TO_BYTE	UINT	BYTE	"*__OUT=(BYTE	)__move_UINT	(EN,__ENO,IN);"	
-$create	UINT_TO_DINT	UINT	DINT	"*__OUT=(DINT	)__move_UINT	(EN,__ENO,IN);"	
-$create	UINT_TO_DWORD	UINT	DWORD	"*__OUT=(DWORD	)__move_UINT	(EN,__ENO,IN);"	
-$create	UINT_TO_INT	UINT	INT	"*__OUT=(INT	)__move_UINT	(EN,__ENO,IN);"	
-$create	UINT_TO_LINT	UINT	LINT	"*__OUT=(LINT	)__move_UINT	(EN,__ENO,IN);"	
-$create	UINT_TO_LREAL	UINT	LREAL	"*__OUT=(LREAL	)__move_UINT	(EN,__ENO,IN);"	
-$create	UINT_TO_LWORD	UINT	LWORD	"*__OUT=(LWORD	)__move_UINT	(EN,__ENO,IN);"	
-$create	UINT_TO_REAL	UINT	REAL	"*__OUT=(REAL	)__move_UINT	(EN,__ENO,IN);"	
-$create	UINT_TO_SINT	UINT	SINT	"*__OUT=(SINT	)__move_UINT	(EN,__ENO,IN);"	
-$create	UINT_TO_UDINT	UINT	UDINT	"*__OUT=(UDINT	)__move_UINT	(EN,__ENO,IN);"	
-$create	UINT_TO_ULINT	UINT	ULINT	"*__OUT=(ULINT	)__move_UINT	(EN,__ENO,IN);"	
-$create	UINT_TO_USINT	UINT	USINT	"*__OUT=(USINT	)__move_UINT	(EN,__ENO,IN);"	
-$create	UINT_TO_WORD	UINT	WORD	"*__OUT=(WORD	)__move_UINT	(EN,__ENO,IN);"	
-$create	ULINT_TO_BOOL	ULINT	BOOL	"*__OUT=(BOOL	)__move_ULINT	(EN,__ENO,IN);"	
-$create	ULINT_TO_BYTE	ULINT	BYTE	"*__OUT=(BYTE	)__move_ULINT	(EN,__ENO,IN);"	
-$create	ULINT_TO_DINT	ULINT	DINT	"*__OUT=(DINT	)__move_ULINT	(EN,__ENO,IN);"	
-$create	ULINT_TO_DWORD	ULINT	DWORD	"*__OUT=(DWORD	)__move_ULINT	(EN,__ENO,IN);"	
-$create	ULINT_TO_INT	ULINT	INT	"*__OUT=(INT	)__move_ULINT	(EN,__ENO,IN);"	
-$create	ULINT_TO_LINT	ULINT	LINT	"*__OUT=(LINT	)__move_ULINT	(EN,__ENO,IN);"	
-$create	ULINT_TO_LREAL	ULINT	LREAL	"*__OUT=(LREAL	)__move_ULINT	(EN,__ENO,IN);"	
-$create	ULINT_TO_LWORD	ULINT	LWORD	"*__OUT=(LWORD	)__move_ULINT	(EN,__ENO,IN);"	
-$create	ULINT_TO_REAL	ULINT	REAL	"*__OUT=(REAL	)__move_ULINT	(EN,__ENO,IN);"	
-$create	ULINT_TO_SINT	ULINT	SINT	"*__OUT=(SINT	)__move_ULINT	(EN,__ENO,IN);"	
-$create	ULINT_TO_UDINT	ULINT	UDINT	"*__OUT=(UDINT	)__move_ULINT	(EN,__ENO,IN);"	
-$create	ULINT_TO_UINT	ULINT	UINT	"*__OUT=(UINT	)__move_ULINT	(EN,__ENO,IN);"	
-$create	ULINT_TO_USINT	ULINT	USINT	"*__OUT=(USINT	)__move_ULINT	(EN,__ENO,IN);"	
-$create	ULINT_TO_WORD	ULINT	WORD	"*__OUT=(WORD	)__move_ULINT	(EN,__ENO,IN);"	
-$create	USINT_TO_BOOL	USINT	BOOL	"*__OUT=(BOOL	)__move_USINT	(EN,__ENO,IN);"	
-$create	USINT_TO_BYTE	USINT	BYTE	"*__OUT=(BYTE	)__move_USINT	(EN,__ENO,IN);"	
-$create	USINT_TO_DINT	USINT	DINT	"*__OUT=(DINT	)__move_USINT	(EN,__ENO,IN);"	
-$create	USINT_TO_DWORD	USINT	DWORD	"*__OUT=(DWORD	)__move_USINT	(EN,__ENO,IN);"	
-$create	USINT_TO_INT	USINT	INT	"*__OUT=(INT	)__move_USINT	(EN,__ENO,IN);"	
-$create	USINT_TO_LINT	USINT	LINT	"*__OUT=(LINT	)__move_USINT	(EN,__ENO,IN);"	
-$create	USINT_TO_LREAL	USINT	LREAL	"*__OUT=(LREAL	)__move_USINT	(EN,__ENO,IN);"	
-$create	USINT_TO_LWORD	USINT	LWORD	"*__OUT=(LWORD	)__move_USINT	(EN,__ENO,IN);"	
-$create	USINT_TO_REAL	USINT	REAL	"*__OUT=(REAL	)__move_USINT	(EN,__ENO,IN);"	
-$create	USINT_TO_SINT	USINT	SINT	"*__OUT=(SINT	)__move_USINT	(EN,__ENO,IN);"	
-$create	USINT_TO_UDINT	USINT	UDINT	"*__OUT=(UDINT	)__move_USINT	(EN,__ENO,IN);"	
-$create	USINT_TO_UINT	USINT	UINT	"*__OUT=(UINT	)__move_USINT	(EN,__ENO,IN);"	
-$create	USINT_TO_ULINT	USINT	ULINT	"*__OUT=(ULINT	)__move_USINT	(EN,__ENO,IN);"	
-$create	USINT_TO_WORD	USINT	WORD	"*__OUT=(WORD	)__move_USINT	(EN,__ENO,IN);"	
-$create	WORD_TO_BOOL	WORD	BOOL	"*__OUT=(BOOL	)__move_WORD	(EN,__ENO,IN);"	
-$create	WORD_TO_BYTE	WORD	BYTE	"*__OUT=(BYTE	)__move_WORD	(EN,__ENO,IN);"	
-$create	WORD_TO_DINT	WORD	DINT	"*__OUT=(DINT	)__move_WORD	(EN,__ENO,IN);"	
-$create	WORD_TO_DWORD	WORD	DWORD	"*__OUT=(DWORD	)__move_WORD	(EN,__ENO,IN);"	
-$create	WORD_TO_INT	WORD	INT	"*__OUT=(INT	)__move_WORD	(EN,__ENO,IN);"	
-$create	WORD_TO_LINT	WORD	LINT	"*__OUT=(LINT	)__move_WORD	(EN,__ENO,IN);"	
-$create	WORD_TO_LREAL	WORD	LREAL	"*__OUT=(LREAL	)__move_WORD	(EN,__ENO,IN);"	
-$create	WORD_TO_LWORD	WORD	LWORD	"*__OUT=(LWORD	)__move_WORD	(EN,__ENO,IN);"	
-$create	WORD_TO_REAL	WORD	REAL	"*__OUT=(REAL	)__move_WORD	(EN,__ENO,IN);"	
-$create	WORD_TO_SINT	WORD	SINT	"*__OUT=(SINT	)__move_WORD	(EN,__ENO,IN);"	
-$create	WORD_TO_UDINT	WORD	UDINT	"*__OUT=(UDINT	)__move_WORD	(EN,__ENO,IN);"	
-$create	WORD_TO_UINT	WORD	UINT	"*__OUT=(UINT	)__move_WORD	(EN,__ENO,IN);"	
-$create	WORD_TO_ULINT	WORD	ULINT	"*__OUT=(ULINT	)__move_WORD	(EN,__ENO,IN);"	
-$create	WORD_TO_USINT	WORD	USINT	"*__OUT=(USINT	)__move_WORD	(EN,__ENO,IN);"	
-
-
-########################
-# Handling strings...  #
-########################
-$create	STRING_TO_BOOL	STRING	BOOL	"*__OUT=(BOOL	)__string_to_bool	(EN,__ENO,IN);"	
-$create	STRING_TO_BYTE	STRING	BYTE	"*__OUT=(BYTE	)__string_to_bit	(EN,__ENO,IN);"	
-$create	STRING_TO_WORD	STRING	WORD	"*__OUT=(WORD	)__string_to_bit	(EN,__ENO,IN);"	
-$create	STRING_TO_DWORD	STRING	DWORD	"*__OUT=(DWORD	)__string_to_bit	(EN,__ENO,IN);"	
-$create	STRING_TO_LWORD	STRING	LWORD	"*__OUT=(LWORD	)__string_to_bit	(EN,__ENO,IN);"	
-$create	STRING_TO_SINT	STRING	SINT	"*__OUT=(SINT	)__string_to_sint	(EN,__ENO,IN);"	
-$create	STRING_TO_INT	STRING	INT	"*__OUT=(INT	)__string_to_sint	(EN,__ENO,IN);"	
-$create	STRING_TO_DINT	STRING	DINT	"*__OUT=(DINT	)__string_to_sint	(EN,__ENO,IN);"	
-$create	STRING_TO_LINT	STRING	LINT	"*__OUT=(LINT	)__string_to_sint	(EN,__ENO,IN);"	
-$create	STRING_TO_USINT	STRING	USINT	"*__OUT=(USINT	)__string_to_uint	(EN,__ENO,IN);"	
-$create	STRING_TO_UINT	STRING	UINT	"*__OUT=(UINT	)__string_to_uint	(EN,__ENO,IN);"	
-$create	STRING_TO_UDINT	STRING	UDINT	"*__OUT=(UDINT	)__string_to_uint	(EN,__ENO,IN);"	
-$create	STRING_TO_ULINT	STRING	ULINT	"*__OUT=(ULINT	)__string_to_uint	(EN,__ENO,IN);"	
-$create	STRING_TO_REAL	STRING	REAL	"*__OUT=(REAL	)__string_to_real	(EN,__ENO,IN);"	
-$create	STRING_TO_LREAL	STRING	LREAL	"*__OUT=(LREAL	)__string_to_real	(EN,__ENO,IN);"	
-$create	STRING_TO_DATE	STRING	DATE	"*__OUT=(DATE	)__string_to_time	(EN,__ENO,IN);"
-$create	STRING_TO_TIME	STRING	TIME	"*__OUT=(TIME	)__string_to_time	(EN,__ENO,IN);"
-$create	STRING_TO_TOD	STRING	TOD	"*__OUT=(TOD	)__string_to_time	(EN,__ENO,IN);"
-$create	STRING_TO_DT	STRING	DT	"*__OUT=(DT	)__string_to_time	(EN,__ENO,IN);"
-
-$create	BOOL_TO_STRING	BOOL	STRING	"*__OUT=(STRING	)__bool_to_string	(EN,__ENO,IN);"
-$create	BYTE_TO_STRING	BYTE	STRING	"*__OUT=(STRING	)__bit_to_string	(EN,__ENO,IN);"
-$create	WORD_TO_STRING	WORD	STRING	"*__OUT=(STRING	)__bit_to_string	(EN,__ENO,IN);"
-$create	DWORD_TO_STRING	DWORD	STRING	"*__OUT=(STRING	)__bit_to_string	(EN,__ENO,IN);"
-$create	LWORD_TO_STRING	LWORD	STRING	"*__OUT=(STRING	)__bit_to_string	(EN,__ENO,IN);"
-$create	INT_TO_STRING	INT	STRING	"*__OUT=(STRING	)__sint_to_string	(EN,__ENO,IN);"
-$create	LINT_TO_STRING	LINT	STRING	"*__OUT=(STRING	)__sint_to_string	(EN,__ENO,IN);"
-$create	DINT_TO_STRING	DINT	STRING	"*__OUT=(STRING	)__sint_to_string	(EN,__ENO,IN);"
-$create	SINT_TO_STRING	SINT	STRING	"*__OUT=(STRING	)__sint_to_string	(EN,__ENO,IN);"
-$create	USINT_TO_STRING	USINT	STRING	"*__OUT=(STRING	)__uint_to_string	(EN,__ENO,IN);"
-$create	UINT_TO_STRING	UINT	STRING	"*__OUT=(STRING	)__uint_to_string	(EN,__ENO,IN);"
-$create	UDINT_TO_STRING	UDINT	STRING	"*__OUT=(STRING	)__uint_to_string	(EN,__ENO,IN);"
-$create	ULINT_TO_STRING	ULINT	STRING	"*__OUT=(STRING	)__uint_to_string	(EN,__ENO,IN);"
-$create	REAL_TO_STRING	REAL	STRING	"*__OUT=(STRING	)__real_to_string	(EN,__ENO,IN);"
-$create	LREAL_TO_STRING	LREAL	STRING	"*__OUT=(STRING	)__real_to_string	(EN,__ENO,IN);"
-$create	DATE_TO_STRING	DATE	STRING	"*__OUT=(STRING	)__date_to_string	(EN,__ENO,IN);"
-$create	DT_TO_STRING	DT	STRING	"*__OUT=(STRING	)__dt_to_string	(EN,__ENO,IN);"
-$create	TIME_TO_STRING	TIME	STRING	"*__OUT=(STRING	)__time_to_string	(EN,__ENO,IN);"
-$create	TOD_TO_STRING	TOD	STRING	"*__OUT=(STRING	)__tod_to_string	(EN,__ENO,IN);"
-
-########################
-# Handling of dates    #
-########################
-$create	BOOL_TO_DATE	BOOL	DATE	"*__OUT=(DATE	)__int_to_time	(EN,__ENO,IN);"
-$create	BYTE_TO_DATE	BYTE	DATE	"*__OUT=(DATE	)__int_to_time	(EN,__ENO,IN);"
-$create	WORD_TO_DATE	WORD	DATE	"*__OUT=(DATE	)__int_to_time	(EN,__ENO,IN);"
-$create	DWORD_TO_DATE	DWORD	DATE	"*__OUT=(DATE	)__int_to_time	(EN,__ENO,IN);"
-$create	LWORD_TO_DATE	LWORD	DATE	"*__OUT=(DATE	)__int_to_time	(EN,__ENO,IN);"
-$create	SINT_TO_DATE	SINT	DATE	"*__OUT=(DATE	)__int_to_time	(EN,__ENO,IN);"
-$create	INT_TO_DATE	INT	DATE	"*__OUT=(DATE	)__int_to_time	(EN,__ENO,IN);"
-$create	DINT_TO_DATE	DINT	DATE	"*__OUT=(DATE	)__int_to_time	(EN,__ENO,IN);"
-$create	LINT_TO_DATE	LINT	DATE	"*__OUT=(DATE	)__int_to_time	(EN,__ENO,IN);"
-$create	USINT_TO_DATE	USINT	DATE	"*__OUT=(DATE	)__int_to_time	(EN,__ENO,IN);"
-$create	UINT_TO_DATE	UINT	DATE	"*__OUT=(DATE	)__int_to_time	(EN,__ENO,IN);"
-$create	UDINT_TO_DATE	UDINT	DATE	"*__OUT=(DATE	)__int_to_time	(EN,__ENO,IN);"
-$create	ULINT_TO_DATE	ULINT	DATE	"*__OUT=(DATE	)__int_to_time	(EN,__ENO,IN);"
-$create	REAL_TO_DATE	REAL	DATE	"*__OUT=(DATE	)__real_to_time	(EN,__ENO,IN);"
-$create	LREAL_TO_DATE	LREAL	DATE	"*__OUT=(DATE	)__real_to_time	(EN,__ENO,IN);"
-
-$create	DATE_TO_BYTE	DATE	BYTE	"*__OUT=(BYTE	)__time_to_int	(EN,__ENO,IN);"	
-$create	DATE_TO_WORD	DATE	WORD	"*__OUT=(WORD	)__time_to_int	(EN,__ENO,IN);"	
-$create	DATE_TO_DWORD	DATE	DWORD	"*__OUT=(DWORD	)__time_to_int	(EN,__ENO,IN);"	
-$create	DATE_TO_LWORD	DATE	LWORD	"*__OUT=(LWORD	)__time_to_int	(EN,__ENO,IN);"	
-$create	DATE_TO_SINT	DATE	SINT	"*__OUT=(SINT	)__time_to_int	(EN,__ENO,IN);"	
-$create	DATE_TO_INT	DATE	INT	"*__OUT=(INT	)__time_to_int	(EN,__ENO,IN);"	
-$create	DATE_TO_DINT	DATE	DINT	"*__OUT=(DINT	)__time_to_int	(EN,__ENO,IN);"	
-$create	DATE_TO_LINT	DATE	LINT	"*__OUT=(LINT	)__time_to_int	(EN,__ENO,IN);"	
-$create	DATE_TO_USINT	DATE	USINT	"*__OUT=(USINT	)__time_to_int	(EN,__ENO,IN);"	
-$create	DATE_TO_UINT	DATE	UINT	"*__OUT=(UINT	)__time_to_int	(EN,__ENO,IN);"	
-$create	DATE_TO_UDINT	DATE	UDINT	"*__OUT=(UDINT	)__time_to_int	(EN,__ENO,IN);"	
-$create	DATE_TO_ULINT	DATE	ULINT	"*__OUT=(ULINT	)__time_to_int	(EN,__ENO,IN);"	
-$create	DATE_TO_REAL	DATE	REAL	"*__OUT=(REAL	)__time_to_real	(EN,__ENO,IN);"	
-$create	DATE_TO_LREAL	DATE	LREAL	"*__OUT=(LREAL	)__time_to_real	(EN,__ENO,IN);"	
-
-########################
-# Handling of TIME     #
-########################
-$create	BOOL_TO_TIME	BOOL	TIME	"*__OUT=(TIME	)__int_to_time	(EN,__ENO,IN);"
-$create	BYTE_TO_TIME	BYTE	TIME	"*__OUT=(TIME	)__int_to_time	(EN,__ENO,IN);"
-$create	WORD_TO_TIME	WORD	TIME	"*__OUT=(TIME	)__int_to_time	(EN,__ENO,IN);"
-$create	DWORD_TO_TIME	DWORD	TIME	"*__OUT=(TIME	)__int_to_time	(EN,__ENO,IN);"
-$create	LWORD_TO_TIME	LWORD	TIME	"*__OUT=(TIME	)__int_to_time	(EN,__ENO,IN);"
-$create	SINT_TO_TIME	SINT	TIME	"*__OUT=(TIME	)__int_to_time	(EN,__ENO,IN);"
-$create	INT_TO_TIME	INT	TIME	"*__OUT=(TIME	)__int_to_time	(EN,__ENO,IN);"
-$create	DINT_TO_TIME	DINT	TIME	"*__OUT=(TIME	)__int_to_time	(EN,__ENO,IN);"
-$create	LINT_TO_TIME	LINT	TIME	"*__OUT=(TIME	)__int_to_time	(EN,__ENO,IN);"
-$create	USINT_TO_TIME	USINT	TIME	"*__OUT=(TIME	)__int_to_time	(EN,__ENO,IN);"
-$create	UINT_TO_TIME	UINT	TIME	"*__OUT=(TIME	)__int_to_time	(EN,__ENO,IN);"
-$create	UDINT_TO_TIME	UDINT	TIME	"*__OUT=(TIME	)__int_to_time	(EN,__ENO,IN);"
-$create	ULINT_TO_TIME	ULINT	TIME	"*__OUT=(TIME	)__int_to_time	(EN,__ENO,IN);"
-$create	REAL_TO_TIME	REAL	TIME	"*__OUT=(TIME	)__real_to_time	(EN,__ENO,IN);"
-$create	LREAL_TO_TIME	LREAL	TIME	"*__OUT=(TIME	)__real_to_time	(EN,__ENO,IN);"
-
-$create	TIME_TO_BYTE	TIME	BYTE	"*__OUT=(BYTE	)__time_to_int	(EN,__ENO,IN);"	
-$create	TIME_TO_WORD	TIME	WORD	"*__OUT=(WORD	)__time_to_int	(EN,__ENO,IN);"	
-$create	TIME_TO_DWORD	TIME	DWORD	"*__OUT=(DWORD	)__time_to_int	(EN,__ENO,IN);"	
-$create	TIME_TO_LWORD	TIME	LWORD	"*__OUT=(LWORD	)__time_to_int	(EN,__ENO,IN);"	
-$create	TIME_TO_SINT	TIME	SINT	"*__OUT=(SINT	)__time_to_int	(EN,__ENO,IN);"	
-$create	TIME_TO_INT	TIME	INT	"*__OUT=(INT	)__time_to_int	(EN,__ENO,IN);"	
-$create	TIME_TO_DINT	TIME	DINT	"*__OUT=(DINT	)__time_to_int	(EN,__ENO,IN);"	
-$create	TIME_TO_LINT	TIME	LINT	"*__OUT=(LINT	)__time_to_int	(EN,__ENO,IN);"	
-$create	TIME_TO_USINT	TIME	USINT	"*__OUT=(USINT	)__time_to_int	(EN,__ENO,IN);"	
-$create	TIME_TO_UINT	TIME	UINT	"*__OUT=(UINT	)__time_to_int	(EN,__ENO,IN);"	
-$create	TIME_TO_UDINT	TIME	UDINT	"*__OUT=(UDINT	)__time_to_int	(EN,__ENO,IN);"	
-$create	TIME_TO_ULINT	TIME	ULINT	"*__OUT=(ULINT	)__time_to_int	(EN,__ENO,IN);"	
-$create	TIME_TO_REAL	TIME	REAL	"*__OUT=(REAL	)__time_to_real	(EN,__ENO,IN);"	
-$create	TIME_TO_LREAL	TIME	LREAL	"*__OUT=(LREAL	)__time_to_real	(EN,__ENO,IN);"	
-
-
-##############################
-# Handling of DATE_AND_TIME  #
-##############################
-$create	BOOL_TO_DT	BOOL	DT	"*__OUT=(DT	)__int_to_time	(EN,__ENO,IN);"
-$create	BYTE_TO_DT	BYTE	DT	"*__OUT=(DT	)__int_to_time	(EN,__ENO,IN);"
-$create	WORD_TO_DT	WORD	DT	"*__OUT=(DT	)__int_to_time	(EN,__ENO,IN);"
-$create	DWORD_TO_DT	DWORD	DT	"*__OUT=(DT	)__int_to_time	(EN,__ENO,IN);"
-$create	LWORD_TO_DT	LWORD	DT	"*__OUT=(DT	)__int_to_time	(EN,__ENO,IN);"
-$create	SINT_TO_DT	SINT	DT	"*__OUT=(DT	)__int_to_time	(EN,__ENO,IN);"
-$create	INT_TO_DT	INT	DT	"*__OUT=(DT	)__int_to_time	(EN,__ENO,IN);"
-$create	DINT_TO_DT	DINT	DT	"*__OUT=(DT	)__int_to_time	(EN,__ENO,IN);"
-$create	LINT_TO_DT	LINT	DT	"*__OUT=(DT	)__int_to_time	(EN,__ENO,IN);"
-$create	USINT_TO_DT	USINT	DT	"*__OUT=(DT	)__int_to_time	(EN,__ENO,IN);"
-$create	UINT_TO_DT	UINT	DT	"*__OUT=(DT	)__int_to_time	(EN,__ENO,IN);"
-$create	UDINT_TO_DT	UDINT	DT	"*__OUT=(DT	)__int_to_time	(EN,__ENO,IN);"
-$create	ULINT_TO_DT	ULINT	DT	"*__OUT=(DT	)__int_to_time	(EN,__ENO,IN);"
-$create	REAL_TO_DT	REAL	DT	"*__OUT=(DT	)__real_to_time	(EN,__ENO,IN);"
-$create	LREAL_TO_DT	LREAL	DT	"*__OUT=(DT	)__real_to_time	(EN,__ENO,IN);"
-
-$create	DT_TO_BYTE	DT	BYTE	"*__OUT=(BYTE	)__time_to_int	(EN,__ENO,IN);"	
-$create	DT_TO_WORD	DT	WORD	"*__OUT=(WORD	)__time_to_int	(EN,__ENO,IN);"	
-$create	DT_TO_DWORD	DT	DWORD	"*__OUT=(DWORD	)__time_to_int	(EN,__ENO,IN);"	
-$create	DT_TO_LWORD	DT	LWORD	"*__OUT=(LWORD	)__time_to_int	(EN,__ENO,IN);"	
-$create	DT_TO_SINT	DT	SINT	"*__OUT=(SINT	)__time_to_int	(EN,__ENO,IN);"	
-$create	DT_TO_INT	DT	INT	"*__OUT=(INT	)__time_to_int	(EN,__ENO,IN);"	
-$create	DT_TO_DINT	DT	DINT	"*__OUT=(DINT	)__time_to_int	(EN,__ENO,IN);"	
-$create	DT_TO_LINT	DT	LINT	"*__OUT=(LINT	)__time_to_int	(EN,__ENO,IN);"	
-$create	DT_TO_USINT	DT	USINT	"*__OUT=(USINT	)__time_to_int	(EN,__ENO,IN);"	
-$create	DT_TO_UINT	DT	UINT	"*__OUT=(UINT	)__time_to_int	(EN,__ENO,IN);"	
-$create	DT_TO_UDINT	DT	UDINT	"*__OUT=(UDINT	)__time_to_int	(EN,__ENO,IN);"	
-$create	DT_TO_ULINT	DT	ULINT	"*__OUT=(ULINT	)__time_to_int	(EN,__ENO,IN);"	
-$create	DT_TO_REAL	DT	REAL	"*__OUT=(REAL	)__time_to_real	(EN,__ENO,IN);"	
-$create	DT_TO_LREAL	DT	LREAL	"*__OUT=(LREAL	)__time_to_real	(EN,__ENO,IN);"	
-
-
-####################
-# Handling of TOD  #
-####################
-
-$create	BOOL_TO_TOD	BOOL	TOD	"*__OUT=(TOD	)__int_to_time	(EN,__ENO,IN);"
-$create	BYTE_TO_TOD	BYTE	TOD	"*__OUT=(TOD	)__int_to_time	(EN,__ENO,IN);"
-$create	WORD_TO_TOD	WORD	TOD	"*__OUT=(TOD	)__int_to_time	(EN,__ENO,IN);"
-$create	DWORD_TO_TOD	DWORD	TOD	"*__OUT=(TOD	)__int_to_time	(EN,__ENO,IN);"
-$create	LWORD_TO_TOD	LWORD	TOD	"*__OUT=(TOD	)__int_to_time	(EN,__ENO,IN);"
-$create	SINT_TO_TOD	SINT	TOD	"*__OUT=(TOD	)__int_to_time	(EN,__ENO,IN);"
-$create	INT_TO_TOD	INT	TOD	"*__OUT=(TOD	)__int_to_time	(EN,__ENO,IN);"
-$create	DINT_TO_TOD	DINT	TOD	"*__OUT=(TOD	)__int_to_time	(EN,__ENO,IN);"
-$create	LINT_TO_TOD	LINT	TOD	"*__OUT=(TOD	)__int_to_time	(EN,__ENO,IN);"
-$create	USINT_TO_TOD	USINT	TOD	"*__OUT=(TOD	)__int_to_time	(EN,__ENO,IN);"
-$create	UINT_TO_TOD	UINT	TOD	"*__OUT=(TOD	)__int_to_time	(EN,__ENO,IN);"
-$create	UDINT_TO_TOD	UDINT	TOD	"*__OUT=(TOD	)__int_to_time	(EN,__ENO,IN);"
-$create	ULINT_TO_TOD	ULINT	TOD	"*__OUT=(TOD	)__int_to_time	(EN,__ENO,IN);"
-$create	REAL_TO_TOD	REAL	TOD	"*__OUT=(TOD	)__real_to_time	(EN,__ENO,IN);"
-$create	LREAL_TO_TOD	LREAL	TOD	"*__OUT=(TOD	)__real_to_time	(EN,__ENO,IN);"
-
-$create	TOD_TO_BYTE	TOD	BYTE	"*__OUT=(BYTE	)__time_to_int	(EN,__ENO,IN);"	
-$create	TOD_TO_WORD	TOD	WORD	"*__OUT=(WORD	)__time_to_int	(EN,__ENO,IN);"	
-$create	TOD_TO_DWORD	TOD	DWORD	"*__OUT=(DWORD	)__time_to_int	(EN,__ENO,IN);"	
-$create	TOD_TO_LWORD	TOD	LWORD	"*__OUT=(LWORD	)__time_to_int	(EN,__ENO,IN);"	
-$create	TOD_TO_SINT	TOD	SINT	"*__OUT=(SINT	)__time_to_int	(EN,__ENO,IN);"	
-$create	TOD_TO_INT	TOD	INT	"*__OUT=(INT	)__time_to_int	(EN,__ENO,IN);"	
-$create	TOD_TO_DINT	TOD	DINT	"*__OUT=(DINT	)__time_to_int	(EN,__ENO,IN);"	
-$create	TOD_TO_LINT	TOD	LINT	"*__OUT=(LINT	)__time_to_int	(EN,__ENO,IN);"	
-$create	TOD_TO_USINT	TOD	USINT	"*__OUT=(USINT	)__time_to_int	(EN,__ENO,IN);"	
-$create	TOD_TO_UINT	TOD	UINT	"*__OUT=(UINT	)__time_to_int	(EN,__ENO,IN);"	
-$create	TOD_TO_UDINT	TOD	UDINT	"*__OUT=(UDINT	)__time_to_int	(EN,__ENO,IN);"	
-$create	TOD_TO_ULINT	TOD	ULINT	"*__OUT=(ULINT	)__time_to_int	(EN,__ENO,IN);"	
-$create	TOD_TO_REAL	TOD	REAL	"*__OUT=(REAL	)__time_to_real	(EN,__ENO,IN);"	
-$create	TOD_TO_LREAL	TOD	LREAL	"*__OUT=(LREAL	)__time_to_real	(EN,__ENO,IN);"	
-
-
-
-                                                                                                                                                 
-$create DATE_AND_TIME_TO_TIME_OF_DAY	DT       TOD	"*__OUT = (TOD	)__date_and_time_to_time_of_day(EN,__ENO,IN);" 
-$create DATE_AND_TIME_TO_DATE	DT	DATE	"*__OUT = (DATE	)__date_and_time_to_date(EN,__ENO,IN);" 
-                                                                                                                     
-
-
-
-$create_end    
-
-                                                                                          
-# *BCD_TO_**   and   **_TO_BCD*     are not yet supported                        
-# We comment them out for now...                                                  
-exit 0                                                                                     
-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                      
-
-
-
-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/iec_std_lib.h	Tue Apr 05 14:24:07 2011 +0100
+++ b/lib/iec_std_lib.h	Tue Apr 05 17:12:12 2011 +0100
@@ -148,7 +148,7 @@
 }
 
 
-static inline void __normalize_timespec (struct timespec *ts) {
+static inline void __normalize_timespec (IEC_TIMESPEC *ts) {
   if( ts->tv_nsec < -1000000000 || (( ts->tv_sec > 0 ) && ( ts->tv_nsec < 0 ))){
     ts->tv_sec--;
     ts->tv_nsec += 1000000000;
@@ -159,8 +159,8 @@
   }
 }
 
-static inline struct timespec __time_to_timespec(int sign, double mseconds, double seconds, double minutes, double hours, double days) {
-  struct timespec ts;
+static inline IEC_TIMESPEC __time_to_timespec(int sign, double mseconds, double seconds, double minutes, double hours, double days) {
+  IEC_TIMESPEC ts;
 
   /* sign is 1 for positive values, -1 for negative time... */
   long double total_sec = ((days*24 + hours)*60 + minutes)*60 + seconds + mseconds/1e3;
@@ -172,8 +172,8 @@
 }
 
 
-static inline struct timespec __tod_to_timespec(double seconds, double minutes, double hours) {
-  struct timespec ts;
+static inline IEC_TIMESPEC __tod_to_timespec(double seconds, double minutes, double hours) {
+  IEC_TIMESPEC ts;
 
   long double total_sec = (hours*60 + minutes)*60 + seconds;
   ts.tv_sec = (long int)total_sec;
@@ -182,8 +182,8 @@
   return ts;
 }
 
-static inline struct timespec __date_to_timespec(int day, int month, int year) {
-  struct timespec ts;
+static inline IEC_TIMESPEC __date_to_timespec(int day, int month, int year) {
+  IEC_TIMESPEC ts;
   struct tm broken_down_time;
   time_t epoch_seconds;
 
@@ -205,8 +205,8 @@
   return ts;
 }
 
-static inline struct timespec __dt_to_timespec(double seconds,  double minutes, double hours, int day, int month, int year) {
-  struct timespec ts;
+static inline IEC_TIMESPEC __dt_to_timespec(double seconds,  double minutes, double hours, int day, int month, int year) {
+  IEC_TIMESPEC ts;
   struct tm broken_down_time;
   time_t epoch_seconds;
 
@@ -791,7 +791,7 @@
     return res;
 }
 
-/* workaround for va-atgs limitation on shorter that int params */
+/* workaround for va-args limitation on shorter than int params */
 #define VA_ARGS_REAL LREAL
 #define VA_ARGS_LREAL LREAL
 #define VA_ARGS_SINT DINT
--- a/lib/iec_std_lib_generated.h	Tue Apr 05 14:24:07 2011 +0100
+++ b/lib/iec_std_lib_generated.h	Tue Apr 05 17:12:12 2011 +0100
@@ -1,17 +1,21 @@
 /*
- * (c) 2008 Edouard TISSERANT
+ * Copyright (C) 2007-2011: Edouard TISSERANT and Laurent BESSARD
  *
- * Offered to the public under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
+ * See COPYING and COPYING.LESSER files for copyright details.
  *
- * 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 Lesser
- * General Public License for more details.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
  *
- * This code is made available on the understanding that it will not be
- * used in safety-critical situations without a full and competent review.
+ * This library 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
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public License 
+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
  */
 
 /****
--- a/lib/iec_types.h	Tue Apr 05 14:24:07 2011 +0100
+++ b/lib/iec_types.h	Tue Apr 05 17:12:12 2011 +0100
@@ -3,7 +3,6 @@
 
 #include <limits.h>
 #include <float.h>
-#include <time.h>
 #include <stdint.h>
 
 /*********************/
@@ -30,22 +29,15 @@
 typedef float    IEC_REAL;
 typedef double   IEC_LREAL;
 
-
-#if !defined __timespec_defined && !defined __time_t_defined
-# define __timespec_defined     1
-
-struct timespec
-  {
+typedef struct {
     long int tv_sec;            /* Seconds.  */
     long int tv_nsec;           /* Nanoseconds.  */
-  };
+}__attribute__((packed)) IEC_TIMESPEC;
 
-#endif
-
-typedef struct timespec IEC_TIME;
-typedef struct timespec IEC_DATE;
-typedef struct timespec IEC_DT;
-typedef struct timespec IEC_TOD;
+typedef IEC_TIMESPEC IEC_TIME;
+typedef IEC_TIMESPEC IEC_DATE;
+typedef IEC_TIMESPEC IEC_DT;
+typedef IEC_TIMESPEC IEC_TOD;
 
 #ifndef STR_MAX_LEN
 #define STR_MAX_LEN 126
@@ -59,6 +51,6 @@
 typedef struct {
     __strlen_t len;
     uint8_t body[STR_MAX_LEN];
-} IEC_STRING;
+} __attribute__((packed)) IEC_STRING;
 
 #endif /*IEC_TYPES_H*/
--- a/lib/ieclib.txt	Tue Apr 05 14:24:07 2011 +0100
+++ b/lib/ieclib.txt	Tue Apr 05 17:12:12 2011 +0100
@@ -21,23 +21,9 @@
  * 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)
- *
- *)
+(* This is the library conatining the standard 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 *)
+(* FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10) *)
 {#include "edge_detection.txt" }
 {#include "bistable.txt" }
 {#include "counter.txt" }
@@ -48,5 +34,6 @@
 {#include "pid_st.txt" }
 {#include "ramp_st.txt" }
 
-(* Some usefull non-standard function blocks *)
+(* Frome later versions of the standard *)
 {#include "sema.txt" }
+
--- a/lib/test_iec_std_lib.c	Tue Apr 05 14:24:07 2011 +0100
+++ b/lib/test_iec_std_lib.c	Tue Apr 05 17:12:12 2011 +0100
@@ -1,3 +1,29 @@
+/*
+ *  matiec - a compiler for the programming languages defined in IEC 61131-3
+ *
+ *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
+ *
+ *  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.
+ *
+ * Test bed for C implementation of standard IEC functions.
+ *
+ */
 
 #include "iec_std_lib.h"
 
--- a/main.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/main.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -1,6 +1,7 @@
 /*
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/stage1_2/Makefile	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage1_2/Makefile	Tue Apr 05 17:12:12 2011 +0100
@@ -1,3 +1,21 @@
+# matiec - a compiler for the programming languages defined in IEC 61131-3
+#
+# Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+# Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
+#
+# 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/>.
+
 # include the system specific Makefile
 include ../Makefile.$(shell uname)
 
--- a/stage1_2/iec.y	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage1_2/iec.y	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
@@ -7971,6 +7972,11 @@
   FILE *in_file = NULL, *lib_file = NULL;
   char *libfilename = NULL;
 	
+  for(int i = 0; standard_function_names[i] != NULL; i++)
+    if (library_element_symtable.find_value(standard_function_names[i]) ==
+        library_element_symtable.end_value())
+      library_element_symtable.insert(standard_function_names[i], standard_function_name_token);
+
   if((in_file = fopen(filename, "r")) == NULL) {
     char *errmsg = strdup2("Error opening main file ", filename);
     perror(errmsg);
@@ -8023,11 +8029,6 @@
   /* if by any chance the library is not complete, we
    * now add the missing reserved keywords to the list!!!
    */
-  for(int i = 0; standard_function_names[i] != NULL; i++)
-    if (library_element_symtable.find_value(standard_function_names[i]) ==
-        library_element_symtable.end_value())
-      library_element_symtable.insert(standard_function_names[i], standard_function_name_token);
-
   for(int i = 0; standard_function_block_names[i] != NULL; i++)
     if (library_element_symtable.find_value(standard_function_block_names[i]) ==
         library_element_symtable.end_value())
--- a/stage1_2/stage1_2.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage1_2/stage1_2.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/stage1_2/stage1_2.hh	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage1_2/stage1_2.hh	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/stage1_2/stage1_2_priv.hh	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage1_2/stage1_2_priv.hh	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/stage1_2/standard_function_names.c	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage1_2/standard_function_names.c	Tue Apr 05 17:12:12 2011 +0100
@@ -1,31 +1,20 @@
 /*
- *  matiec - a compiler for the programming languages defined in IEC 61131-3
+ * Copyright (C) 2007-2011: Edouard TISSERANT and Laurent BESSARD
  *
- *  Copyright (C) 2008 Edouard TISSERANT
+ * See COPYING and COPYING.LESSER files for copyright 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 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.
+ * 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)
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
@@ -423,9 +412,19 @@
 "ACOS",
 "ATAN",
 "ADD",
+"ADD_TIME",
+"ADD_TOD_TIME",
+"ADD_DT_TIME",
 "MUL",
+"MULTIME",
 "SUB",
+"SUB_TIME",
+"SUB_DATE_DATE",
+"SUB_TOD_TIME",
+"SUB_TOD_TOD",
+"SUB_DT_TIME",
 "DIV",
+"DIVTIME",
 "MOD",
 "EXPT",
 "MOVE",
@@ -453,6 +452,7 @@
 "RIGHT",
 "MID",
 "CONCAT",
+"CONCAT_DAT_TOD",
 "INSERT",
 "DELETE",
 "REPLACE",
--- a/stage3/Makefile	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage3/Makefile	Tue Apr 05 17:12:12 2011 +0100
@@ -1,9 +1,24 @@
+# matiec - a compiler for the programming languages defined in IEC 61131-3
+#
+# Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+# Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
+#
+# 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/>.
+
 # include the system specific Makefile
 include ../Makefile.$(shell uname)
 
-
-
-
 STAGE3_FILES  = stage3.o
 STAGE3_FILES += visit_expression_type.o
 
--- a/stage3/stage3.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage3/stage3.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2009-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/stage3/stage3.hh	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage3/stage3.hh	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2009-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/stage3/visit_expression_type.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage3/visit_expression_type.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2009-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
@@ -57,7 +58,7 @@
                                   (symbol1))
 
 #define STAGE3_ERROR(symbol1, symbol2, msg) {                                          \
-    fprintf(stderr, "semantic error between (%d:%d) and (%d:%d): %s\n",                \
+    fprintf(stderr, "plc.st:%d-%d..%d-%d: error : %s\n",                \
            FIRST_(symbol1,symbol2)->first_line, FIRST_(symbol1,symbol2)->first_column, \
            LAST_(symbol1,symbol2) ->last_line,  LAST_(symbol1,symbol2) ->last_column,  \
            msg);                                                                       \
--- a/stage3/visit_expression_type.hh	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage3/visit_expression_type.hh	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2009-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/stage4/Makefile	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage4/Makefile	Tue Apr 05 17:12:12 2011 +0100
@@ -1,4 +1,22 @@
+# matiec - a compiler for the programming languages defined in IEC 61131-3
+#
+# Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+# Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
+#
+# 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/>.
 # include the system specific Makefile
+
 include ../Makefile.$(shell uname)
 
 
--- a/stage4/generate_c/Makefile	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage4/generate_c/Makefile	Tue Apr 05 17:12:12 2011 +0100
@@ -1,3 +1,21 @@
+# matiec - a compiler for the programming languages defined in IEC 61131-3
+#
+# Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+# Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
+#
+# 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/>.
+
 # include the system specific Makefile
 include ../../Makefile.$(shell uname)
 
--- a/stage4/generate_c/generate_c.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage4/generate_c/generate_c.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
@@ -21,28 +22,6 @@
  * 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)
- *
- */
-
-
-/*
- * This is one of the versions available for the 4th stage.
- *
- * This 4th stage generates a c++ source program equivalent
- * to the IL and ST code.
- */
-
-
-
-
-
-
-// #include <stdio.h>  /* required for NULL */
 #include <string>
 #include <iostream>
 #include <sstream>
@@ -57,12 +36,6 @@
 
 #include "../stage4.hh"
 
-
-
-
-
-
-
 //#define DEBUG
 #ifdef DEBUG
 #define TRACE(classname) printf("\n____%s____\n",classname);
@@ -70,18 +43,10 @@
 #define TRACE(classname)
 #endif
 
-
-
 #define ERROR error_exit(__FILE__,__LINE__)
 /* function defined in main.cc */
 extern void error_exit(const char *file_name, int line_no);
 
-
-
-
-/***********************************************************************/
-/***********************************************************************/
-/***********************************************************************/
 /***********************************************************************/
 
 /* Unlike Programs and Configurations which get mapped onto C++ classes,
@@ -1083,7 +1048,9 @@
   s4o.print("(void) {\n");
   s4o.indent_right();
   s4o.print(s4o.indent_spaces);
-  s4o.print("BOOL retain = 0;\n");
+  s4o.print("BOOL retain;\n");
+  s4o.print(s4o.indent_spaces);
+  s4o.print("retain = 0;\n");
   
   /* (B.3) Global variables initializations... */
   s4o.print(s4o.indent_spaces);
@@ -1371,7 +1338,9 @@
       s4o.print("(void) {\n");
       s4o.indent_right();
       s4o.print(s4o.indent_spaces);
-      s4o.print("BOOL retain = 0;\n");
+      s4o.print("BOOL retain;\n");
+      s4o.print(s4o.indent_spaces);
+      s4o.print("retain = 0;\n");
       
       /* (B.2) Global variables initialisations... */
       if (current_global_vars != NULL) {
--- a/stage4/generate_c/generate_c.hh	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage4/generate_c/generate_c.hh	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/stage4/generate_c/generate_c_base.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage4/generate_c/generate_c_base.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -1,49 +1,27 @@
 /*
- * (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)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
- * 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.
- *
- * Based on the
- * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
- *
- */
-
-
-/*
- * Conversion of basic abstract syntax constructs.
- *
- * This is part of the 4th stage that generates
- * a c++ source program equivalent to the IL and ST
- * code.
- */
-
-
-
-
-
-
-//#include <stdio.h>  /* required for NULL */
-//#include <string>
-//#include <iostream>
-
-//#include "../../util/symtable.hh"
-
-//#include "generate_c.hh"
-
 #include <string.h>
 
 
--- a/stage4/generate_c/generate_c_configbody.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage4/generate_c/generate_c_configbody.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -1,56 +1,27 @@
 /*
- * (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)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
- * 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.
- *
- * Based on the
- * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
- *
- */
-
-
-/*
- * Build the body of the main function (currently named run() )
- * of the class onto which is mapped a specific CONFIGURATION.
- *
- * This is part of the 4th stage that generates
- * a c++ source program equivalent to the IL and ST
- * code.
- */
-
-
-
-
-
-
-// #include <stdio.h>  /* required for NULL */
-/*
-#include <string>
-#include <iostream>
-
-#include "../../util/symtable.hh"
-
-#include "../stage4.hh"
-*/
-
-
-
-
-
 class generate_c_configbody_c: public generate_c_base_c {
 
   public:
--- a/stage4/generate_c/generate_c_il.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage4/generate_c/generate_c_il.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -1,39 +1,27 @@
 /*
- * (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)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
- * 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.
- *
- * Based on the
- * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
- *
- */
-
-
-/*
- * Conversion of il statements (i.e. IL code).
- *
- * This is part of the 4th stage that generates
- * a c++ source program equivalent to the IL and ST
- * code.
- */
-
-
-
-
 /***********************************************************************/
 /***********************************************************************/
 /***********************************************************************/
--- a/stage4/generate_c/generate_c_inlinefcall.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage4/generate_c/generate_c_inlinefcall.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -1,34 +1,27 @@
 /*
- * (c) 2007 Mario de Sousa and Laurent Bessard
+ *  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)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
- * 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.
- *
- * Based on the
- * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
- *
- */
-
-/*
- * This is one of the versions available for the 4th stage.
- *
- * This 4th stage generates a c++ source program equivalent
- * to the IL and ST code.
- */
-
 
 #define INLINE_RESULT_TEMP_VAR "__res"
 
--- a/stage4/generate_c/generate_c_sfc.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage4/generate_c/generate_c_sfc.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -1,36 +1,27 @@
 /*
- * (c) 2007 Mario de Sousa, Laurent Bessard
+ *  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)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
- * 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.
- *
- * Based on the
- * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
- *
- */
-
-
-/*
- * Conversion of sfc networks (i.e. SFC code).
- *
- * This is part of the 4th stage that generates
- * a c++ source program equivalent to the SFC, IL and ST
- * code.
- */
-
 typedef struct
 {
   transition_c *symbol;
--- a/stage4/generate_c/generate_c_sfcdecl.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage4/generate_c/generate_c_sfcdecl.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -1,36 +1,27 @@
 /*
- * (c) 2007 Mario de Sousa, Laurent Bessard
- *
- * 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)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
+ *
+ *  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.
- *
- * Based on the
- * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
- *
- */
-
-
-/*
- * Conversion of sfc networks (i.e. SFC code).
- *
- * This is part of the 4th stage that generates
- * a c++ source program equivalent to the SFC, IL and ST
- * code.
- */
-
 typedef struct
 {
   identifier_c *symbol;
--- a/stage4/generate_c/generate_c_st.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage4/generate_c/generate_c_st.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -1,21 +1,24 @@
 /*
- * (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)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
- * 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.
  *
  * Based on the
  * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
@@ -27,7 +30,7 @@
  * Conversion of st statements (i.e. ST code).
  *
  * This is part of the 4th stage that generates
- * a c++ source program equivalent to the IL and ST
+ * a C source program equivalent to the IL and ST, or SFC
  * code.
  */
 
--- a/stage4/generate_c/generate_c_typedecl.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage4/generate_c/generate_c_typedecl.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -1,51 +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)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
+ *
+ *  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.
- *
- * Based on the
- * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
- *
- */
-
-
-/*
- * Conversion of type declaration constructs.
- *
- * This is part of the 4th stage that generates
- * a c++ source program equivalent to the IL and ST
- * code.
- */
-
-
-
-
-
-
-//#include <stdio.h>  /* required for NULL */
-//#include <string>
-//#include <iostream>
-
-//#include "../../util/symtable.hh"
-
-
 #include <stdlib.h>
 
-
 class generate_c_typedecl_c: public generate_c_base_c {
 
   protected:
--- a/stage4/generate_c/generate_c_vardecl.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage4/generate_c/generate_c_vardecl.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -1,45 +1,27 @@
 /*
- * (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)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
- * 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.
- *
- * Based on the
- * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
- *
- */
-
-
-/*
- * Conversion of variable declaration constructs.
- *
- * This is part of the 4th stage that generates
- * a c++ source program equivalent to the IL and ST
- * code.
- */
-
-
-
-
-//#include <stdio.h>  /* required for NULL */
-//#include <string>
-//#include <iostream>
-
-//#include "../../util/symtable.hh"
-
 class initialization_analyzer_c: public null_visitor_c {
   public:
 	typedef enum {
--- a/stage4/generate_c/generate_location_list.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage4/generate_c/generate_location_list.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -1,57 +1,27 @@
 /*
- * (c) 2007 Mario de Sousa and Laurent Bessard
+ *  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)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
- * 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.
- *
- * Based on the
- * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
- *
- */
-
-/*
- * This is one of the versions available for the 4th stage.
- *
- * This 4th stage generates a c++ source program equivalent
- * to the IL and ST code.
- */
-
-//#include <stdio.h>  /* required for NULL */
-//#include <string>
-//#include <iostream>
-
-//#include "../../util/symtable.hh"
-
-
-
-
-
-
-
-
-
-/***********************************************************************/
-/***********************************************************************/
-/***********************************************************************/
-/***********************************************************************/
-/***********************************************************************/
-/***********************************************************************/
-/***********************************************************************/
-/***********************************************************************/
-
 class generate_location_list_c: public iterator_visitor_c {
 
   protected:
--- a/stage4/generate_c/generate_var_list.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage4/generate_c/generate_var_list.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -1,43 +1,30 @@
 /*
- * (c) 2007 Mario de Sousa and Laurent Bessard
+ *  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)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
- * 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.
  *
  * Based on the
  * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
  *
  */
 
-/*
- * This is one of the versions available for the 4th stage.
- *
- * This 4th stage generates a c++ source program equivalent
- * to the IL and ST code.
- */
-
-//#include <stdio.h>  /* required for NULL */
-//#include <string>
-//#include <iostream>
-
-//#include "../../util/symtable.hh"
-
-
-
-
 typedef struct
 {
   symbol_c *symbol;
--- a/stage4/generate_c/il_code_gen.c	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage4/generate_c/il_code_gen.c	Tue Apr 05 17:12:12 2011 +0100
@@ -1,24 +1,20 @@
 /*
- * (c) 2008 Edouard TISSERANT
+ * Copyright (C) 2007-2011: Edouard TISSERANT and Laurent BESSARD
  *
- * 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.
+ * See COPYING and COPYING.LESSER files for copyright details.
  *
- * 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 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.
+ * 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.
  *
- * Based on the
- * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
@@ -14372,6 +14368,192 @@
     break;
 
 /****
+ *ADD_TIME
+ */
+    case function_add_time :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = &this->default_variable_name;
+        
+            symbol_c *IN1_type_symbol = param_data_type;
+            last_type_symbol = param_data_type;
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+                    {
+                
+                        function_name = (symbol_c*)(new pragma_c("__time_add"));
+                        
+                        if (IN1_type_symbol == NULL)
+                          IN1_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN1_param_name, IN1_param_value, IN1_type_symbol, function_param_iterator_c::direction_in)
+                        
+                        if (IN2_type_symbol == NULL)
+                          IN2_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN2_param_name, IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        break;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_add_time*/
+    break;
+
+/****
+ *ADD_TOD_TIME
+ */
+    case function_add_tod_time :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = &this->default_variable_name;
+        
+            symbol_c *IN1_type_symbol = param_data_type;
+            last_type_symbol = param_data_type;
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+                    {
+                
+                        function_name = (symbol_c*)(new pragma_c("__time_add"));
+                        
+                        if (IN1_type_symbol == NULL)
+                          IN1_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN1_param_name, IN1_param_value, IN1_type_symbol, function_param_iterator_c::direction_in)
+                        
+                        if (IN2_type_symbol == NULL)
+                          IN2_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN2_param_name, IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
+                        symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name;
+                        break;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_add_tod_time*/
+    break;
+
+/****
+ *ADD_DT_TIME
+ */
+    case function_add_dt_time :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = &this->default_variable_name;
+        
+            symbol_c *IN1_type_symbol = param_data_type;
+            last_type_symbol = param_data_type;
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+                    {
+                
+                        function_name = (symbol_c*)(new pragma_c("__time_add"));
+                        
+                        if (IN1_type_symbol == NULL)
+                          IN1_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN1_param_name, IN1_param_value, IN1_type_symbol, function_param_iterator_c::direction_in)
+                        
+                        if (IN2_type_symbol == NULL)
+                          IN2_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN2_param_name, IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
+                        symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name;
+                        break;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_add_dt_time*/
+    break;
+
+/****
  *MUL
  */
     case function_mul :
@@ -14508,9 +14690,9 @@
     break;
 
 /****
- *SUB
- */
-    case function_sub :
+ *MULTIME
+ */
+    case function_multime :
     {
         symbol_c *last_type_symbol = NULL;
 
@@ -14522,7 +14704,7 @@
             symbol_c *IN1_type_symbol = param_data_type;
             last_type_symbol = param_data_type;
             
-            if(IN1_type_symbol == NULL || search_expression_type->is_num_type(IN1_type_symbol))
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
             {
         
                 {
@@ -14542,7 +14724,7 @@
                     if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
                     {
                 
-                        function_name = (symbol_c*)(new pragma_c("__sub_"));
+                        function_name = (symbol_c*)(new pragma_c("__time_mul"));
                         
                         if (IN1_type_symbol == NULL)
                           IN1_type_symbol = last_type_symbol;
@@ -14551,8 +14733,9 @@
                         if (IN2_type_symbol == NULL)
                           IN2_type_symbol = last_type_symbol;
                         ADD_PARAM_LIST(IN2_param_name, IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
-                        symbol_c * return_type_symbol = last_type_symbol;
-                        function_type_suffix = return_type_symbol;
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        if (search_expression_type->is_literal_integer_type(function_type_suffix))
+                            function_type_suffix = &search_constant_type_c::lint_type_name;
                         break;
                         
                     }
@@ -14563,7 +14746,29 @@
                 
             }
             
-            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol))
+            
+            ERROR;
+        }
+        
+    }/*function_multime*/
+    break;
+
+/****
+ *SUB
+ */
+    case function_sub :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = &this->default_variable_name;
+        
+            symbol_c *IN1_type_symbol = param_data_type;
+            last_type_symbol = param_data_type;
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_num_type(IN1_type_symbol))
             {
         
                 {
@@ -14580,10 +14785,10 @@
                       last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
                     }
                     
-                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol))
+                    if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
                     {
                 
-                        function_name = (symbol_c*)(new pragma_c("__time_sub"));
+                        function_name = (symbol_c*)(new pragma_c("__sub_"));
                         
                         if (IN1_type_symbol == NULL)
                           IN1_type_symbol = last_type_symbol;
@@ -14592,7 +14797,8 @@
                         if (IN2_type_symbol == NULL)
                           IN2_type_symbol = last_type_symbol;
                         ADD_PARAM_LIST(IN2_param_name, IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
-                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        symbol_c * return_type_symbol = last_type_symbol;
+                        function_type_suffix = return_type_symbol;
                         break;
                         
                     }
@@ -14603,7 +14809,7 @@
                 
             }
             
-            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol))
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol))
             {
         
                 {
@@ -14620,7 +14826,7 @@
                       last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
                     }
                     
-                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol))
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol))
                     {
                 
                         function_name = (symbol_c*)(new pragma_c("__time_sub"));
@@ -14637,30 +14843,13 @@
                         
                     }
                     
-                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
-                    {
-                
-                        function_name = (symbol_c*)(new pragma_c("__time_sub"));
-                        
-                        if (IN1_type_symbol == NULL)
-                          IN1_type_symbol = last_type_symbol;
-                        ADD_PARAM_LIST(IN1_param_name, IN1_param_value, IN1_type_symbol, function_param_iterator_c::direction_in)
-                        
-                        if (IN2_type_symbol == NULL)
-                          IN2_type_symbol = last_type_symbol;
-                        ADD_PARAM_LIST(IN2_param_name, IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
-                        symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name;
-                        break;
-                        
-                    }
-                    
                     
                     ERROR;
                 }
                 
             }
             
-            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol))
             {
         
                 {
@@ -14677,7 +14866,7 @@
                       last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
                     }
                     
-                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol))
                     {
                 
                         function_name = (symbol_c*)(new pragma_c("__time_sub"));
@@ -14706,7 +14895,7 @@
                         if (IN2_type_symbol == NULL)
                           IN2_type_symbol = last_type_symbol;
                         ADD_PARAM_LIST(IN2_param_name, IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
-                        symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name;
+                        symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name;
                         break;
                         
                     }
@@ -14717,7 +14906,7 @@
                 
             }
             
-            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
             {
         
                 {
@@ -14734,7 +14923,7 @@
                       last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
                     }
                     
-                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
                     {
                 
                         function_name = (symbol_c*)(new pragma_c("__time_sub"));
@@ -14751,35 +14940,30 @@
                         
                     }
                     
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+                    {
+                
+                        function_name = (symbol_c*)(new pragma_c("__time_sub"));
+                        
+                        if (IN1_type_symbol == NULL)
+                          IN1_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN1_param_name, IN1_param_value, IN1_type_symbol, function_param_iterator_c::direction_in)
+                        
+                        if (IN2_type_symbol == NULL)
+                          IN2_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN2_param_name, IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
+                        symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name;
+                        break;
+                        
+                    }
+                    
                     
                     ERROR;
                 }
                 
             }
             
-            
-            ERROR;
-        }
-        
-    }/*function_sub*/
-    break;
-
-/****
- *DIV
- */
-    case function_div :
-    {
-        symbol_c *last_type_symbol = NULL;
-
-        {
-            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
-            /* Get the value from a foo(<param_name> = <param_value>) style call */
-            symbol_c *IN1_param_value = &this->default_variable_name;
-        
-            symbol_c *IN1_type_symbol = param_data_type;
-            last_type_symbol = param_data_type;
-            
-            if(IN1_type_symbol == NULL || search_expression_type->is_num_type(IN1_type_symbol))
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
             {
         
                 {
@@ -14796,10 +14980,10 @@
                       last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
                     }
                     
-                    if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
                     {
                 
-                        function_name = (symbol_c*)(new pragma_c("__div_"));
+                        function_name = (symbol_c*)(new pragma_c("__time_sub"));
                         
                         if (IN1_type_symbol == NULL)
                           IN1_type_symbol = last_type_symbol;
@@ -14808,8 +14992,7 @@
                         if (IN2_type_symbol == NULL)
                           IN2_type_symbol = last_type_symbol;
                         ADD_PARAM_LIST(IN2_param_name, IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
-                        symbol_c * return_type_symbol = last_type_symbol;
-                        function_type_suffix = return_type_symbol;
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
                         break;
                         
                     }
@@ -14820,6 +15003,28 @@
                 
             }
             
+            
+            ERROR;
+        }
+        
+    }/*function_sub*/
+    break;
+
+/****
+ *SUB_TIME
+ */
+    case function_sub_time :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = &this->default_variable_name;
+        
+            symbol_c *IN1_type_symbol = param_data_type;
+            last_type_symbol = param_data_type;
+            
             if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
             {
         
@@ -14837,6 +15042,374 @@
                       last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
                     }
                     
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+                    {
+                
+                        function_name = (symbol_c*)(new pragma_c("__time_sub"));
+                        
+                        if (IN1_type_symbol == NULL)
+                          IN1_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN1_param_name, IN1_param_value, IN1_type_symbol, function_param_iterator_c::direction_in)
+                        
+                        if (IN2_type_symbol == NULL)
+                          IN2_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN2_param_name, IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        break;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_sub_time*/
+    break;
+
+/****
+ *SUB_DATE_DATE
+ */
+    case function_sub_date_date :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = &this->default_variable_name;
+        
+            symbol_c *IN1_type_symbol = param_data_type;
+            last_type_symbol = param_data_type;
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol))
+                    {
+                
+                        function_name = (symbol_c*)(new pragma_c("__time_sub"));
+                        
+                        if (IN1_type_symbol == NULL)
+                          IN1_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN1_param_name, IN1_param_value, IN1_type_symbol, function_param_iterator_c::direction_in)
+                        
+                        if (IN2_type_symbol == NULL)
+                          IN2_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN2_param_name, IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        break;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_sub_date_date*/
+    break;
+
+/****
+ *SUB_TOD_TIME
+ */
+    case function_sub_tod_time :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = &this->default_variable_name;
+        
+            symbol_c *IN1_type_symbol = param_data_type;
+            last_type_symbol = param_data_type;
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+                    {
+                
+                        function_name = (symbol_c*)(new pragma_c("__time_sub"));
+                        
+                        if (IN1_type_symbol == NULL)
+                          IN1_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN1_param_name, IN1_param_value, IN1_type_symbol, function_param_iterator_c::direction_in)
+                        
+                        if (IN2_type_symbol == NULL)
+                          IN2_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN2_param_name, IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
+                        symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name;
+                        break;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_sub_tod_time*/
+    break;
+
+/****
+ *SUB_TOD_TOD
+ */
+    case function_sub_tod_tod :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = &this->default_variable_name;
+        
+            symbol_c *IN1_type_symbol = param_data_type;
+            last_type_symbol = param_data_type;
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
+                    {
+                
+                        function_name = (symbol_c*)(new pragma_c("__time_sub"));
+                        
+                        if (IN1_type_symbol == NULL)
+                          IN1_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN1_param_name, IN1_param_value, IN1_type_symbol, function_param_iterator_c::direction_in)
+                        
+                        if (IN2_type_symbol == NULL)
+                          IN2_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN2_param_name, IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        break;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_sub_tod_tod*/
+    break;
+
+/****
+ *SUB_DT_TIME
+ */
+    case function_sub_dt_time :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = &this->default_variable_name;
+        
+            symbol_c *IN1_type_symbol = param_data_type;
+            last_type_symbol = param_data_type;
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol))
+                    {
+                
+                        function_name = (symbol_c*)(new pragma_c("__time_sub"));
+                        
+                        if (IN1_type_symbol == NULL)
+                          IN1_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN1_param_name, IN1_param_value, IN1_type_symbol, function_param_iterator_c::direction_in)
+                        
+                        if (IN2_type_symbol == NULL)
+                          IN2_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN2_param_name, IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        break;
+                        
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+                    {
+                
+                        function_name = (symbol_c*)(new pragma_c("__time_sub"));
+                        
+                        if (IN1_type_symbol == NULL)
+                          IN1_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN1_param_name, IN1_param_value, IN1_type_symbol, function_param_iterator_c::direction_in)
+                        
+                        if (IN2_type_symbol == NULL)
+                          IN2_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN2_param_name, IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
+                        symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name;
+                        break;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_sub_dt_time*/
+    break;
+
+/****
+ *DIV
+ */
+    case function_div :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = &this->default_variable_name;
+        
+            symbol_c *IN1_type_symbol = param_data_type;
+            last_type_symbol = param_data_type;
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_num_type(IN1_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
+                    {
+                
+                        function_name = (symbol_c*)(new pragma_c("__div_"));
+                        
+                        if (IN1_type_symbol == NULL)
+                          IN1_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN1_param_name, IN1_param_value, IN1_type_symbol, function_param_iterator_c::direction_in)
+                        
+                        if (IN2_type_symbol == NULL)
+                          IN2_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN2_param_name, IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
+                        symbol_c * return_type_symbol = last_type_symbol;
+                        function_type_suffix = return_type_symbol;
+                        break;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
                     if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
                     {
                 
@@ -14870,6 +15443,70 @@
     break;
 
 /****
+ *DIVTIME
+ */
+    case function_divtime :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = &this->default_variable_name;
+        
+            symbol_c *IN1_type_symbol = param_data_type;
+            last_type_symbol = param_data_type;
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
+                    {
+                
+                        function_name = (symbol_c*)(new pragma_c("__time_div"));
+                        
+                        if (IN1_type_symbol == NULL)
+                          IN1_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN1_param_name, IN1_param_value, IN1_type_symbol, function_param_iterator_c::direction_in)
+                        
+                        if (IN2_type_symbol == NULL)
+                          IN2_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN2_param_name, IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        if (search_expression_type->is_literal_integer_type(function_type_suffix))
+                            function_type_suffix = &search_constant_type_c::lint_type_name;
+                        break;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_divtime*/
+    break;
+
+/****
  *MOD
  */
     case function_mod :
@@ -16927,46 +17564,6 @@
             symbol_c *IN1_type_symbol = param_data_type;
             last_type_symbol = param_data_type;
             
-            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol))
-            {
-        
-                {
-                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
-                    /* Get the value from a foo(<param_name> = <param_value>) style call */
-                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
-                    symbol_c *IN2_type_symbol = NULL;
-                    
-                    /* Get the value from a foo(<param_value>) style call */
-                    if (IN2_param_value == NULL)
-                      IN2_param_value = function_call_param_iterator.next_nf();
-                    if (IN2_param_value != NULL) {
-                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
-                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
-                    }
-                    
-                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
-                    {
-                
-                        function_name = (symbol_c*)(new pragma_c("__time_add"));
-                        
-                        if (IN1_type_symbol == NULL)
-                          IN1_type_symbol = last_type_symbol;
-                        ADD_PARAM_LIST(IN1_param_name, IN1_param_value, IN1_type_symbol, function_param_iterator_c::direction_in)
-                        
-                        if (IN2_type_symbol == NULL)
-                          IN2_type_symbol = last_type_symbol;
-                        ADD_PARAM_LIST(IN2_param_name, IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
-                        symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name;
-                        break;
-                        
-                    }
-                    
-                    
-                    ERROR;
-                }
-                
-            }
-            
             if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol))
             {
         
@@ -17046,6 +17643,68 @@
     break;
 
 /****
+ *CONCAT_DAT_TOD
+ */
+    case function_concat_dat_tod :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = &this->default_variable_name;
+        
+            symbol_c *IN1_type_symbol = param_data_type;
+            last_type_symbol = param_data_type;
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
+                    {
+                
+                        function_name = (symbol_c*)(new pragma_c("__time_add"));
+                        
+                        if (IN1_type_symbol == NULL)
+                          IN1_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN1_param_name, IN1_param_value, IN1_type_symbol, function_param_iterator_c::direction_in)
+                        
+                        if (IN2_type_symbol == NULL)
+                          IN2_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN2_param_name, IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
+                        symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name;
+                        break;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_concat_dat_tod*/
+    break;
+
+/****
  *INSERT
  */
     case function_insert :
--- a/stage4/generate_c/st_code_gen.c	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage4/generate_c/st_code_gen.c	Tue Apr 05 17:12:12 2011 +0100
@@ -1,24 +1,20 @@
 /*
- * (c) 2008 Edouard TISSERANT
+ * Copyright (C) 2007-2011: Edouard TISSERANT and Laurent BESSARD
  *
- * 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.
+ * See COPYING and COPYING.LESSER files for copyright details.
  *
- * 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 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.
+ * 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.
  *
- * Based on the
- * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
@@ -16694,6 +16690,210 @@
     break;
 
 /****
+ *ADD_TIME
+ */
+    case function_add_time :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = function_call_param_iterator.search_f(IN1_param_name);
+            symbol_c *IN1_type_symbol = NULL;
+            
+            /* Get the value from a foo(<param_value>) style call */
+            if (IN1_param_value == NULL)
+              IN1_param_value = function_call_param_iterator.next_nf();
+            if (IN1_param_value != NULL) {
+              IN1_type_symbol = search_expression_type->get_type(IN1_param_value);
+              last_type_symbol = last_type_symbol && IN1_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ;
+            }
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+                    {
+                
+                        function_name = (symbol_c*)(new pragma_c("__time_add"));
+                        
+                        if (IN1_type_symbol == NULL)
+                          IN1_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN1_param_name, IN1_param_value, IN1_type_symbol, function_param_iterator_c::direction_in)
+                        
+                        if (IN2_type_symbol == NULL)
+                          IN2_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN2_param_name, IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        break;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_add_time*/
+    break;
+
+/****
+ *ADD_TOD_TIME
+ */
+    case function_add_tod_time :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = function_call_param_iterator.search_f(IN1_param_name);
+            symbol_c *IN1_type_symbol = NULL;
+            
+            /* Get the value from a foo(<param_value>) style call */
+            if (IN1_param_value == NULL)
+              IN1_param_value = function_call_param_iterator.next_nf();
+            if (IN1_param_value != NULL) {
+              IN1_type_symbol = search_expression_type->get_type(IN1_param_value);
+              last_type_symbol = last_type_symbol && IN1_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ;
+            }
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+                    {
+                
+                        function_name = (symbol_c*)(new pragma_c("__time_add"));
+                        
+                        if (IN1_type_symbol == NULL)
+                          IN1_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN1_param_name, IN1_param_value, IN1_type_symbol, function_param_iterator_c::direction_in)
+                        
+                        if (IN2_type_symbol == NULL)
+                          IN2_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN2_param_name, IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
+                        symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name;
+                        break;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_add_tod_time*/
+    break;
+
+/****
+ *ADD_DT_TIME
+ */
+    case function_add_dt_time :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = function_call_param_iterator.search_f(IN1_param_name);
+            symbol_c *IN1_type_symbol = NULL;
+            
+            /* Get the value from a foo(<param_value>) style call */
+            if (IN1_param_value == NULL)
+              IN1_param_value = function_call_param_iterator.next_nf();
+            if (IN1_param_value != NULL) {
+              IN1_type_symbol = search_expression_type->get_type(IN1_param_value);
+              last_type_symbol = last_type_symbol && IN1_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ;
+            }
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+                    {
+                
+                        function_name = (symbol_c*)(new pragma_c("__time_add"));
+                        
+                        if (IN1_type_symbol == NULL)
+                          IN1_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN1_param_name, IN1_param_value, IN1_type_symbol, function_param_iterator_c::direction_in)
+                        
+                        if (IN2_type_symbol == NULL)
+                          IN2_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN2_param_name, IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
+                        symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name;
+                        break;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_add_dt_time*/
+    break;
+
+/****
  *MUL
  */
     case function_mul :
@@ -16836,6 +17036,76 @@
     break;
 
 /****
+ *MULTIME
+ */
+    case function_multime :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = function_call_param_iterator.search_f(IN1_param_name);
+            symbol_c *IN1_type_symbol = NULL;
+            
+            /* Get the value from a foo(<param_value>) style call */
+            if (IN1_param_value == NULL)
+              IN1_param_value = function_call_param_iterator.next_nf();
+            if (IN1_param_value != NULL) {
+              IN1_type_symbol = search_expression_type->get_type(IN1_param_value);
+              last_type_symbol = last_type_symbol && IN1_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ;
+            }
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
+                    {
+                
+                        function_name = (symbol_c*)(new pragma_c("__time_mul"));
+                        
+                        if (IN1_type_symbol == NULL)
+                          IN1_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN1_param_name, IN1_param_value, IN1_type_symbol, function_param_iterator_c::direction_in)
+                        
+                        if (IN2_type_symbol == NULL)
+                          IN2_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN2_param_name, IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        if (search_expression_type->is_literal_integer_type(function_type_suffix))
+                            function_type_suffix = &search_constant_type_c::lint_type_name;
+                        break;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_multime*/
+    break;
+
+/****
  *SUB
  */
     case function_sub :
@@ -17099,6 +17369,363 @@
     break;
 
 /****
+ *SUB_TIME
+ */
+    case function_sub_time :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = function_call_param_iterator.search_f(IN1_param_name);
+            symbol_c *IN1_type_symbol = NULL;
+            
+            /* Get the value from a foo(<param_value>) style call */
+            if (IN1_param_value == NULL)
+              IN1_param_value = function_call_param_iterator.next_nf();
+            if (IN1_param_value != NULL) {
+              IN1_type_symbol = search_expression_type->get_type(IN1_param_value);
+              last_type_symbol = last_type_symbol && IN1_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ;
+            }
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+                    {
+                
+                        function_name = (symbol_c*)(new pragma_c("__time_sub"));
+                        
+                        if (IN1_type_symbol == NULL)
+                          IN1_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN1_param_name, IN1_param_value, IN1_type_symbol, function_param_iterator_c::direction_in)
+                        
+                        if (IN2_type_symbol == NULL)
+                          IN2_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN2_param_name, IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        break;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_sub_time*/
+    break;
+
+/****
+ *SUB_DATE_DATE
+ */
+    case function_sub_date_date :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = function_call_param_iterator.search_f(IN1_param_name);
+            symbol_c *IN1_type_symbol = NULL;
+            
+            /* Get the value from a foo(<param_value>) style call */
+            if (IN1_param_value == NULL)
+              IN1_param_value = function_call_param_iterator.next_nf();
+            if (IN1_param_value != NULL) {
+              IN1_type_symbol = search_expression_type->get_type(IN1_param_value);
+              last_type_symbol = last_type_symbol && IN1_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ;
+            }
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol))
+                    {
+                
+                        function_name = (symbol_c*)(new pragma_c("__time_sub"));
+                        
+                        if (IN1_type_symbol == NULL)
+                          IN1_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN1_param_name, IN1_param_value, IN1_type_symbol, function_param_iterator_c::direction_in)
+                        
+                        if (IN2_type_symbol == NULL)
+                          IN2_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN2_param_name, IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        break;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_sub_date_date*/
+    break;
+
+/****
+ *SUB_TOD_TIME
+ */
+    case function_sub_tod_time :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = function_call_param_iterator.search_f(IN1_param_name);
+            symbol_c *IN1_type_symbol = NULL;
+            
+            /* Get the value from a foo(<param_value>) style call */
+            if (IN1_param_value == NULL)
+              IN1_param_value = function_call_param_iterator.next_nf();
+            if (IN1_param_value != NULL) {
+              IN1_type_symbol = search_expression_type->get_type(IN1_param_value);
+              last_type_symbol = last_type_symbol && IN1_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ;
+            }
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+                    {
+                
+                        function_name = (symbol_c*)(new pragma_c("__time_sub"));
+                        
+                        if (IN1_type_symbol == NULL)
+                          IN1_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN1_param_name, IN1_param_value, IN1_type_symbol, function_param_iterator_c::direction_in)
+                        
+                        if (IN2_type_symbol == NULL)
+                          IN2_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN2_param_name, IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
+                        symbol_c * return_type_symbol = &search_constant_type_c::tod_type_name;
+                        break;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_sub_tod_time*/
+    break;
+
+/****
+ *SUB_TOD_TOD
+ */
+    case function_sub_tod_tod :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = function_call_param_iterator.search_f(IN1_param_name);
+            symbol_c *IN1_type_symbol = NULL;
+            
+            /* Get the value from a foo(<param_value>) style call */
+            if (IN1_param_value == NULL)
+              IN1_param_value = function_call_param_iterator.next_nf();
+            if (IN1_param_value != NULL) {
+              IN1_type_symbol = search_expression_type->get_type(IN1_param_value);
+              last_type_symbol = last_type_symbol && IN1_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ;
+            }
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
+                    {
+                
+                        function_name = (symbol_c*)(new pragma_c("__time_sub"));
+                        
+                        if (IN1_type_symbol == NULL)
+                          IN1_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN1_param_name, IN1_param_value, IN1_type_symbol, function_param_iterator_c::direction_in)
+                        
+                        if (IN2_type_symbol == NULL)
+                          IN2_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN2_param_name, IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        break;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_sub_tod_tod*/
+    break;
+
+/****
+ *SUB_DT_TIME
+ */
+    case function_sub_dt_time :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = function_call_param_iterator.search_f(IN1_param_name);
+            symbol_c *IN1_type_symbol = NULL;
+            
+            /* Get the value from a foo(<param_value>) style call */
+            if (IN1_param_value == NULL)
+              IN1_param_value = function_call_param_iterator.next_nf();
+            if (IN1_param_value != NULL) {
+              IN1_type_symbol = search_expression_type->get_type(IN1_param_value);
+              last_type_symbol = last_type_symbol && IN1_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ;
+            }
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::dt_type_name, last_type_symbol))
+                    {
+                
+                        function_name = (symbol_c*)(new pragma_c("__time_sub"));
+                        
+                        if (IN1_type_symbol == NULL)
+                          IN1_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN1_param_name, IN1_param_value, IN1_type_symbol, function_param_iterator_c::direction_in)
+                        
+                        if (IN2_type_symbol == NULL)
+                          IN2_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN2_param_name, IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        break;
+                        
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+                    {
+                
+                        function_name = (symbol_c*)(new pragma_c("__time_sub"));
+                        
+                        if (IN1_type_symbol == NULL)
+                          IN1_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN1_param_name, IN1_param_value, IN1_type_symbol, function_param_iterator_c::direction_in)
+                        
+                        if (IN2_type_symbol == NULL)
+                          IN2_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN2_param_name, IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
+                        symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name;
+                        break;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_sub_dt_time*/
+    break;
+
+/****
  *DIV
  */
     case function_div :
@@ -17210,6 +17837,76 @@
     break;
 
 /****
+ *DIVTIME
+ */
+    case function_divtime :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = function_call_param_iterator.search_f(IN1_param_name);
+            symbol_c *IN1_type_symbol = NULL;
+            
+            /* Get the value from a foo(<param_value>) style call */
+            if (IN1_param_value == NULL)
+              IN1_param_value = function_call_param_iterator.next_nf();
+            if (IN1_param_value != NULL) {
+              IN1_type_symbol = search_expression_type->get_type(IN1_param_value);
+              last_type_symbol = last_type_symbol && IN1_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ;
+            }
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::time_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_num_type(IN2_type_symbol))
+                    {
+                
+                        function_name = (symbol_c*)(new pragma_c("__time_div"));
+                        
+                        if (IN1_type_symbol == NULL)
+                          IN1_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN1_param_name, IN1_param_value, IN1_type_symbol, function_param_iterator_c::direction_in)
+                        
+                        if (IN2_type_symbol == NULL)
+                          IN2_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN2_param_name, IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
+                        symbol_c * return_type_symbol = &search_constant_type_c::time_type_name;
+                        if (search_expression_type->is_literal_integer_type(function_type_suffix))
+                            function_type_suffix = &search_constant_type_c::lint_type_name;
+                        break;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_divtime*/
+    break;
+
+/****
  *MOD
  */
     case function_mod :
@@ -19429,46 +20126,6 @@
               last_type_symbol = last_type_symbol && IN1_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ;
             }
             
-            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol))
-            {
-        
-                {
-                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
-                    /* Get the value from a foo(<param_name> = <param_value>) style call */
-                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
-                    symbol_c *IN2_type_symbol = NULL;
-                    
-                    /* Get the value from a foo(<param_value>) style call */
-                    if (IN2_param_value == NULL)
-                      IN2_param_value = function_call_param_iterator.next_nf();
-                    if (IN2_param_value != NULL) {
-                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
-                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
-                    }
-                    
-                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
-                    {
-                
-                        function_name = (symbol_c*)(new pragma_c("__time_add"));
-                        
-                        if (IN1_type_symbol == NULL)
-                          IN1_type_symbol = last_type_symbol;
-                        ADD_PARAM_LIST(IN1_param_name, IN1_param_value, IN1_type_symbol, function_param_iterator_c::direction_in)
-                        
-                        if (IN2_type_symbol == NULL)
-                          IN2_type_symbol = last_type_symbol;
-                        ADD_PARAM_LIST(IN2_param_name, IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
-                        symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name;
-                        break;
-                        
-                    }
-                    
-                    
-                    ERROR;
-                }
-                
-            }
-            
             if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::string_type_name, last_type_symbol))
             {
         
@@ -19548,6 +20205,74 @@
     break;
 
 /****
+ *CONCAT_DAT_TOD
+ */
+    case function_concat_dat_tod :
+    {
+        symbol_c *last_type_symbol = NULL;
+
+        {
+            symbol_c *IN1_param_name = (symbol_c *)(new identifier_c("IN1"));
+            /* Get the value from a foo(<param_name> = <param_value>) style call */
+            symbol_c *IN1_param_value = function_call_param_iterator.search_f(IN1_param_name);
+            symbol_c *IN1_type_symbol = NULL;
+            
+            /* Get the value from a foo(<param_value>) style call */
+            if (IN1_param_value == NULL)
+              IN1_param_value = function_call_param_iterator.next_nf();
+            if (IN1_param_value != NULL) {
+              IN1_type_symbol = search_expression_type->get_type(IN1_param_value);
+              last_type_symbol = last_type_symbol && IN1_type_symbol && search_expression_type->is_same_type(IN1_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN1_type_symbol, last_type_symbol) : IN1_type_symbol ;
+            }
+            
+            if(IN1_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::date_type_name, last_type_symbol))
+            {
+        
+                {
+                    symbol_c *IN2_param_name = (symbol_c *)(new identifier_c("IN2"));
+                    /* Get the value from a foo(<param_name> = <param_value>) style call */
+                    symbol_c *IN2_param_value = function_call_param_iterator.search_f(IN2_param_name);
+                    symbol_c *IN2_type_symbol = NULL;
+                    
+                    /* Get the value from a foo(<param_value>) style call */
+                    if (IN2_param_value == NULL)
+                      IN2_param_value = function_call_param_iterator.next_nf();
+                    if (IN2_param_value != NULL) {
+                      IN2_type_symbol = search_expression_type->get_type(IN2_param_value);
+                      last_type_symbol = last_type_symbol && IN2_type_symbol && search_expression_type->is_same_type(IN2_type_symbol, last_type_symbol) ? search_expression_type->common_type(IN2_type_symbol, last_type_symbol) : IN2_type_symbol ;
+                    }
+                    
+                    if(IN2_type_symbol == NULL || search_expression_type->is_same_type(&search_constant_type_c::tod_type_name, last_type_symbol))
+                    {
+                
+                        function_name = (symbol_c*)(new pragma_c("__time_add"));
+                        
+                        if (IN1_type_symbol == NULL)
+                          IN1_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN1_param_name, IN1_param_value, IN1_type_symbol, function_param_iterator_c::direction_in)
+                        
+                        if (IN2_type_symbol == NULL)
+                          IN2_type_symbol = last_type_symbol;
+                        ADD_PARAM_LIST(IN2_param_name, IN2_param_value, IN2_type_symbol, function_param_iterator_c::direction_in)
+                        symbol_c * return_type_symbol = &search_constant_type_c::dt_type_name;
+                        break;
+                        
+                    }
+                    
+                    
+                    ERROR;
+                }
+                
+            }
+            
+            
+            ERROR;
+        }
+        
+    }/*function_concat_dat_tod*/
+    break;
+
+/****
  *INSERT
  */
     case function_insert :
--- a/stage4/generate_iec/Makefile	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage4/generate_iec/Makefile	Tue Apr 05 17:12:12 2011 +0100
@@ -1,3 +1,21 @@
+# matiec - a compiler for the programming languages defined in IEC 61131-3
+#
+# Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+# Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
+#
+# 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/>.
+
 # include the system specific Makefile
 include ../../Makefile.$(shell uname)
 
--- a/stage4/generate_iec/generate_iec.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage4/generate_iec/generate_iec.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/stage4/generate_iec/generate_iec.hh	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage4/generate_iec/generate_iec.hh	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/stage4/stage4.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage4/stage4.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/stage4/stage4.hh	Tue Apr 05 14:24:07 2011 +0100
+++ b/stage4/stage4.hh	Tue Apr 05 17:12:12 2011 +0100
@@ -2,6 +2,7 @@
  *  matiec - a compiler for the programming languages defined in IEC 61131-3
  *
  *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
  *  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
--- a/tests/build.sh	Tue Apr 05 14:24:07 2011 +0100
+++ b/tests/build.sh	Tue Apr 05 17:12:12 2011 +0100
@@ -1,4 +1,23 @@
 #!/bin/bash
+# matiec - a compiler for the programming languages defined in IEC 61131-3
+#
+# Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+# Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
+#
+# 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/>.
+#
+# Shell script to build test for unix likes
 
 STFILE=$1
 
--- a/tests/build_win32.sh	Tue Apr 05 14:24:07 2011 +0100
+++ b/tests/build_win32.sh	Tue Apr 05 17:12:12 2011 +0100
@@ -1,4 +1,23 @@
 #!/bin/bash
+# matiec - a compiler for the programming languages defined in IEC 61131-3
+#
+# Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+# Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
+#
+# 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/>.
+#
+# Shell script to build test for windows
 
 STFILE=$1
 
--- a/tests/main.c	Tue Apr 05 14:24:07 2011 +0100
+++ b/tests/main.c	Tue Apr 05 17:12:12 2011 +0100
@@ -1,3 +1,32 @@
+/*
+ *  matiec - a compiler for the programming languages defined in IEC 61131-3
+ *
+ *  Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
+ *
+ *  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.
+ *
+ *
+ * Minimal standaloen C runtime, for test purpose.
+ * TODO : UPDATE
+ *
+ */
+
 #ifdef __WIN32__
 #include <stdio.h>
 #include <sys/timeb.h>
--- a/tests/plc.c	Tue Apr 05 14:24:07 2011 +0100
+++ b/tests/plc.c	Tue Apr 05 17:12:12 2011 +0100
@@ -1,3 +1,31 @@
+/*
+ *  matiec - a compiler for the programming languages defined in IEC 61131-3
+ *
+ *  Copyright (C) 2009-2011  Mario de Sousa (msousa@fe.up.pt)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
+ *
+ *  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.
+ *
+ *
+ * Simple PLC run cycle test implementation - prints every located at each cycle
+ *
+ */
+
 #include "iec_std_lib.h"
 #include <stdio.h>
 
--- a/tests/syntax/identifier/Makefile	Tue Apr 05 14:24:07 2011 +0100
+++ b/tests/syntax/identifier/Makefile	Tue Apr 05 17:12:12 2011 +0100
@@ -1,3 +1,20 @@
+# matiec - a compiler for the programming languages defined in IEC 61131-3
+#
+# Copyright (C) 2003-2011  Mario de Sousa (msousa@fe.up.pt)
+# Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
+#
+# 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/>.
 
 
 default: runtests
--- a/util/dsymtable.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/util/dsymtable.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -1,29 +1,28 @@
 /*
- * (c) 2005 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)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
- * 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.
- *
- * Based on the
- * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
- *
- */
-
-
-/*
  * A generic symbol table that allows duplicate values.
  *
  * This is used to create a symbol table of previously defined
--- a/util/dsymtable.hh	Tue Apr 05 14:24:07 2011 +0100
+++ b/util/dsymtable.hh	Tue Apr 05 17:12:12 2011 +0100
@@ -1,27 +1,27 @@
 /*
- * (c) 2005 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)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
- * 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.
- *
- * Based on the
- * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
- *
- */
-
 
 /*
  * A generic symbol table that allows duplicate values.
--- a/util/symtable.cc	Tue Apr 05 14:24:07 2011 +0100
+++ b/util/symtable.cc	Tue Apr 05 17:12:12 2011 +0100
@@ -1,29 +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)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
- * 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.
- *
- * Based on the
- * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
- *
- */
-
-
-/*
  * A generic symbol table.
  *
  * This is used to create symbol tables such as a list of
--- a/util/symtable.hh	Tue Apr 05 14:24:07 2011 +0100
+++ b/util/symtable.hh	Tue Apr 05 17:12:12 2011 +0100
@@ -1,28 +1,26 @@
 /*
- * (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)
+ *  Copyright (C) 2007-2011  Laurent Bessard and Edouard Tisserant
  *
- * 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.
- *
- * Based on the
- * FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10)
- *
- */
-
-
 /*
  * A generic symbol table.
  *