Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
authorEdouard Tisserant
Tue, 05 Apr 2011 15:18:35 +0200 (2011-04-05)
changeset 521 457578c31074
parent 520 7ca6c3e076f7
child 522 0e0cf6a0b279
child 523 99ba2e3949ed
Updated availables time realted function in standard lib, updated matiec code generator headers according matiec new licencing
generate_IEC_std.py
plcopen/iec_std.csv
--- a/generate_IEC_std.py	Mon Apr 04 11:57:18 2011 +0200
+++ b/generate_IEC_std.py	Tue Apr 05 15:18:35 2011 +0200
@@ -4,7 +4,7 @@
 #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
+#Copyright (C) 2007-2011: Edouard TISSERANT and Laurent BESSARD
 #
 #See COPYING file for copyrights details.
 #
@@ -23,20 +23,18 @@
 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 """
-
  THIS CODE GENARATES C++ CODE FOR IEC2C COMPILER
- GENERATED CODE IS :
- 
-function_type_decl.h - the long enumeration of std function types
-get_function_type_decl.c - the funct that return enumerated according function name
-st_code_gen.c - part of generate_c_st_c::visit(function_invocation)
-                responsible to generate C code for std lib calls
-il_code_gen.c - part of generate_c_il_c::visit(il_function_call)
-                responsible to generate C code for std lib calls
-search_type_code.c - called by search_expression_type_c::visit(function_invocation) 
-                     return type symbol for std function invocation
- 
-"""
+"""
+
+file_list = [
+        ('absyntax_utils',      'function_type_decl','h'        ),
+        ('absyntax_utils',      'get_function_type_decl','c'    ),
+        ('absyntax_utils',      'search_type_code','c'          ),
+        ('stage4/generate_c',   'st_code_gen','c'               ),
+        ('stage4/generate_c',   'il_code_gen','c'               ),
+        ('stage1_2',            'standard_function_names','c'   ),
+        ('lib',                 'iec_std_lib_generated','h'     )
+        ]
 
 # Get definitions
 from plcopen.structures import *
@@ -49,26 +47,22 @@
 #pp = pprint.PrettyPrinter(indent=4)
 
 matiec_header = """/*
- * (c) 2008 Edouard TISSERANT
- *
- * 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)
+ * Copyright (C) 2007-2011: Edouard TISSERANT and Laurent BESSARD
+ *
+ * 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 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/>.
  *
  */
 
@@ -80,19 +74,23 @@
  """
 
 matiec_lesser_header = """/*
- * (c) 2008 Edouard TISSERANT
- *
- * 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.
- *
- * 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 code is made available on the understanding that it will not be
- * used in safety-critical situations without a full and competent review.
+ * Copyright (C) 2007-2011: Edouard TISSERANT and Laurent BESSARD
+ *
+ * See COPYING and COPYING.LESSER files for copyright 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 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/>.
+ *
  */
 
 /****
@@ -286,7 +284,7 @@
 official_order = []
 for section in std_decl:
     for fdecl in section["list"]:
-        if len(official_order)==0 or official_order[-1] != fdecl["name"]:
+        if len(official_order)==0 or fdecl["name"] not in official_order:
             official_order.append(fdecl["name"])
         # store all func by name in a dict
         std_fdecls_fdecl_name = std_fdecls.get(fdecl["name"], {})
@@ -522,15 +520,7 @@
         break
 
 # Now, print that out, or write to files from sys.argv
-for path, name, ext in [
-        ('absyntax_utils','function_type_decl','h'),
-        ('absyntax_utils','get_function_type_decl','c'),
-        ('stage4/generate_c','st_code_gen','c'),
-        ('stage4/generate_c','il_code_gen','c'),
-        ('absyntax_utils','search_type_code','c'),
-        ('stage1_2','standard_function_names','c'),
-        ('lib', 'iec_std_lib_generated','h')
-        ]:
+for path, name, ext in file_list :
     fd = open(os.path.join(sys.argv[1], path, name+'.'+ext),'w')
     fd.write(eval(name))
     fd.close()
--- a/plcopen/iec_std.csv	Mon Apr 04 11:57:18 2011 +0200
+++ b/plcopen/iec_std.csv	Tue Apr 05 15:18:35 2011 +0200
@@ -32,19 +32,30 @@
 ;ATAN;1;(ANY_REAL);ANY_REAL;_("Arc tangent");no;(None, "__atan_", "IN_type");IN_type_symbol
 _("Arithmetic");ADD;1;(ANY_NUM, ANY_NUM);ANY_NUM;_("Addition");yes;(None, "__add_", "return_type");copy_input
 ;ADD;1;(TIME, TIME);TIME;_("Time addition");no;(None, "__time_add", None);defined
-;ADD;1;(TOD, TIME);TOD;_("Time-of-day addition");no;(None, "__time_add", None);defined
-;ADD;1;(DT, TIME);DT;_("Date addition");no;(None, "__time_add", None);defined
+;ADD_TIME;1;(TIME, TIME);TIME;_("Time addition");no;(None, "__time_add", None);defined
+;ADD;1;(TOD, TIME);TOD;_("Time-of-day addition")+" "+_("DEPRECATED");no;(None, "__time_add", None);defined
+;ADD_TOD_TIME;1;(TOD, TIME);TOD;_("Time-of-day addition");no;(None, "__time_add", None);defined
+;ADD;1;(DT, TIME);DT;_("Date addition")+" "+_("DEPRECATED");no;(None, "__time_add", None);defined
+;ADD_DT_TIME;1;(DT, TIME);DT;_("Date addition");no;(None, "__time_add", None);defined
 ;MUL;1;(ANY_NUM, ANY_NUM);ANY_NUM;_("Multiplication");yes;(None, "__mul_", "return_type");copy_input
-;MUL;1;(TIME, ANY_NUM);TIME;_("Time multiplication");no;(None, "__time_mul", None);defined
+;MUL;1;(TIME, ANY_NUM);TIME;_("Time multiplication")+" "+_("DEPRECATED");no;(None, "__time_mul", None);defined
+;MULTIME;1;(TIME, ANY_NUM);TIME;_("Time multiplication");no;(None, "__time_mul", None);defined
 ;SUB;1;(ANY_NUM, ANY_NUM);ANY_NUM;_("Subtraction");no;(None, "__sub_", "return_type");copy_input
+;SUB_TIME;1;(TIME, TIME);TIME;_("Time subtraction");no;(None, "__time_sub", None);defined
 ;SUB;1;(TIME, TIME);TIME;_("Time subtraction");no;(None, "__time_sub", None);defined
-;SUB;1;(DATE, DATE);TIME;_("Date subtraction");no;(None, "__time_sub", None);defined
-;SUB;1;(TOD, TIME);TOD;_("Time-of-day subtraction");no;(None, "__time_sub", None);defined
-;SUB;1;(TOD, TOD);TIME;_("Time-of-day subtraction");no;(None, "__time_sub", None);defined
-;SUB;1;(DT, TIME);DT;_("Date and time subtraction");no;(None, "__time_sub", None);defined
-;SUB;1;(DT, DT);TIME;_("Date and time subtraction");no;(None, "__time_sub", None);defined
+;SUB;1;(DATE, DATE);TIME;_("Date subtraction")+" "+_("DEPRECATED");no;(None, "__time_sub", None);defined
+;SUB_DATE_DATE;1;(DATE, DATE);TIME;_("Date subtraction");no;(None, "__time_sub", None);defined
+;SUB;1;(TOD, TIME);TOD;_("Time-of-day subtraction")+" "+_("DEPRECATED");no;(None, "__time_sub", None);defined
+;SUB_TOD_TIME;1;(TOD, TIME);TOD;_("Time-of-day subtraction");no;(None, "__time_sub", None);defined
+;SUB;1;(TOD, TOD);TIME;_("Time-of-day subtraction")+" "+_("DEPRECATED");no;(None, "__time_sub", None);defined
+;SUB_TOD_TOD;1;(TOD, TOD);TIME;_("Time-of-day subtraction");no;(None, "__time_sub", None);defined
+;SUB;1;(DT, TIME);DT;_("Date and time subtraction")+" "+_("DEPRECATED");no;(None, "__time_sub", None);defined
+;SUB_DT_TIME;1;(DT, TIME);DT;_("Date and time subtraction");no;(None, "__time_sub", None);defined
+;SUB;1;(DT, DT);TIME;_("Date and time subtraction")+" "+_("DEPRECATED");no;(None, "__time_sub", None);defined
+;SUB_DT_TIME;1;(DT, DT);TIME;_("Date and time subtraction");no;(None, "__time_sub", None);defined
 ;DIV;1;(ANY_NUM, ANY_NUM);ANY_NUM;_("Division");no;(None, "__div_", "return_type");copy_input
-;DIV;1;(TIME, ANY_NUM);TIME;_("Time division");no;(None, "__time_div", None);defined
+;DIV;1;(TIME, ANY_NUM);TIME;_("Time division")+" "+_("DEPRECATED");no;(None, "__time_div", None);defined
+;DIVTIME;1;(TIME, ANY_NUM);TIME;_("Time division");no;(None, "__time_div", None);defined
 ;MOD;1;(ANY_NUM, ANY_NUM);ANY_NUM;_("Remainder (modulo)");no;(None, "__mod_", "return_type");copy_input
 ;EXPT;1;(ANY_REAL, ANY_NUM);ANY_REAL;_("Exponent");no;(None, "__expt_", "IN1_type");copy_input
 ;MOVE;1;(ANY);ANY;_("Assignment");no;(None, "__move_", "return_type");copy_input
@@ -72,7 +83,7 @@
 ;RIGHT;1;(STRING, L);STRING;_("string right of");no;(None, "__right", None);defined
 ;MID;1;(STRING, L, P);STRING;_("string from the middle");no;(None, "__mid", None);defined
 ;CONCAT;1;(STRING, STRING);STRING;_("Concatenation");yes;(None, "__concat", None);defined
-;CONCAT;1;(DATE, TOD);DT;_("Time concatenation");no;(None, "__time_add", None);defined
+;CONCAT_DAT_TOD;1;(DATE, TOD);DT;_("Time concatenation");no;(None, "__time_add", None);defined
 ;INSERT;1;(STRING, STRING, P);STRING;_("Insertion (into)");no;(None, "__insert", None);defined
 ;DELETE;1;(STRING, L, P);STRING;_("Deletion (within)");no;(None, "__delete", None);defined
 ;REPLACE;1;(STRING, STRING, L, P);STRING;_("Replacement (within)");no;(None, "__replace", None);defined