generate_IEC_std.py
changeset 58 39cd981ff242
parent 43 4a7e80513edd
child 59 af079a11837b
--- a/generate_IEC_std.py	Fri Jul 27 10:03:24 2007 +0200
+++ b/generate_IEC_std.py	Thu Aug 02 16:51:58 2007 +0200
@@ -1,3 +1,27 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+#This file is part of PLCOpenEditor, a library implementing an IEC 61131-3 editor
+#based on the plcopen standard. 
+#
+#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
+#
+#See COPYING file for copyrights details.
+#
+#This library 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 2.1 of the License, or (at your option) any later version.
+#
+#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
+#General Public License for more details.
+#
+#You should have received a copy of the GNU General Public
+#License along with this library; if not, write to the Free Software
+#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
 """
 
  THIS CODE GENARATES C++ CODE FOR IEC2CC COMPILER
@@ -20,6 +44,32 @@
 #import pprint
 #pp = pprint.PrettyPrinter(indent=4)
 
+matiec_header = """/*
+ * (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.
+ *
+ * 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)
+ *
+ */
+ 
+ """
+
 def ANY_to_compiler_test_type_GEN(typename, paramname):
     """
     Convert ANY_XXX IEC type declaration into IEC2CC's generated type test.
@@ -201,7 +251,7 @@
 """
 Generate the long enumeration of std function types
 """
-function_type_decl =  """
+function_type_decl =  matiec_header + """
 /****
  * IEC 61131-3 standard function lib
  * generated code, do not edit by hand
@@ -218,7 +268,7 @@
 """
 Generate the funct that return enumerated according function name
 """
-get_function_type_decl = """
+get_function_type_decl = matiec_header + """
 /****
  * IEC 61131-3 standard function lib
  * generated code, do not edit by hand
@@ -241,7 +291,7 @@
 Generate the part of generate_cc_st_c::visit(function_invocation)
 that is responsible to generate C code for std lib calls.
 """
-st_code_gen = """
+st_code_gen = matiec_header + """
 /****
  * IEC 61131-3 standard function lib
  * generated code, do not edit by hand
@@ -278,7 +328,7 @@
 Generate the part of generate_cc_il_c::visit(il_function_call)
 that is responsible to generate C code for std lib calls.
 """
-il_code_gen = """
+il_code_gen = matiec_header + """
 /****
  * IEC 61131-3 standard function lib
  * generated code, do not edit by hand
@@ -315,7 +365,7 @@
 Generate the part of search_expression_type_c::visit(function_invocation)
 that is responsible of returning type symbol for function invocation.
 """
-search_type_code =  """
+search_type_code =  matiec_header + """
 /****
  * IEC 61131-3 standard function lib
  * generated code, do not edit by hand
@@ -417,7 +467,7 @@
 """
 Generate the C implementation of the IEC standard function library.
 """
-iec_std_lib_generated =  """
+iec_std_lib_generated = matiec_header + """
 /****
  * IEC 61131-3 standard function lib
  * generated code, do not edit by hand