equal
deleted
inserted
replaced
22 # along with this program; if not, write to the Free Software |
22 # along with this program; if not, write to the Free Software |
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
24 |
24 |
25 |
25 |
26 from __future__ import absolute_import |
26 from __future__ import absolute_import |
27 import string |
|
28 import re |
27 import re |
29 from collections import OrderedDict |
28 from collections import OrderedDict |
|
29 from functools import reduce |
30 |
30 |
31 from plcopen.plcopen import LoadProject |
31 from plcopen.plcopen import LoadProject |
32 from plcopen.definitions import * |
32 from plcopen.definitions import * |
33 |
33 |
34 TypeHierarchy = dict(TypeHierarchy_list) |
34 TypeHierarchy = dict(TypeHierarchy_list) |
102 |
102 |
103 def csv_file_to_table(file): |
103 def csv_file_to_table(file): |
104 """ |
104 """ |
105 take a .csv file and translate it it a "csv_table" |
105 take a .csv file and translate it it a "csv_table" |
106 """ |
106 """ |
107 return [map(string.strip, line.split(';')) for line in file.xreadlines()] |
107 table = [[column.strip() |
|
108 for column in line.split(';')] |
|
109 for line in file.readlines()] |
|
110 return table |
108 |
111 |
109 |
112 |
110 def find_section(section_name, table): |
113 def find_section(section_name, table): |
111 """ |
114 """ |
112 seek into the csv table to a section ( section_name match 1st field ) |
115 seek into the csv table to a section ( section_name match 1st field ) |
262 if store: |
265 if store: |
263 # create the copy of decl dict to be appended to section |
266 # create the copy of decl dict to be appended to section |
264 Function_decl_copy = Function_decl.copy() |
267 Function_decl_copy = Function_decl.copy() |
265 Current_section["list"].append(Function_decl_copy) |
268 Current_section["list"].append(Function_decl_copy) |
266 else: |
269 else: |
267 raise "First function must be in a category" |
270 raise ValueError("First function must be in a category") |
268 |
271 |
269 return Standard_Functions_Decl |
272 return Standard_Functions_Decl |
270 |
273 |
271 |
274 |
272 StdBlckLst.extend(get_standard_funtions(csv_file_to_table(open(StdFuncsCSV)))) |
275 StdBlckLst.extend(get_standard_funtions(csv_file_to_table(open(StdFuncsCSV)))) |