3 |
3 |
4 # This file is part of Beremiz, a Integrated Development Environment for |
4 # This file is part of Beremiz, a Integrated Development Environment for |
5 # programming IEC 61131-3 automates supporting plcopen standard and CanFestival. |
5 # programming IEC 61131-3 automates supporting plcopen standard and CanFestival. |
6 # |
6 # |
7 # Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD |
7 # Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD |
|
8 # Copyright (C) 2017: Andrey Skvortsov |
8 # |
9 # |
9 # See COPYING file for copyrights details. |
10 # See COPYING file for copyrights details. |
10 # |
11 # |
11 # This program is free software; you can redistribute it and/or |
12 # This program is free software; you can redistribute it and/or |
12 # modify it under the terms of the GNU General Public License |
13 # modify it under the terms of the GNU General Public License |
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
24 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
24 |
25 |
25 import os |
26 import os |
26 from POULibrary import POULibrary |
27 from POULibrary import POULibrary |
27 from PythonFileCTNMixin import PythonFileCTNMixin |
28 from PythonFileCTNMixin import PythonFileCTNMixin |
|
29 import util.paths as paths |
28 |
30 |
29 class PythonLibrary(POULibrary): |
31 class PythonLibrary(POULibrary): |
30 def GetLibraryPath(self): |
32 def GetLibraryPath(self): |
31 return os.path.join(os.path.split(__file__)[0], "pous.xml") |
33 return paths.AbsNeighbourFile(__file__, "pous.xml") |
32 |
34 |
33 def Generate_C(self, buildpath, varlist, IECCFLAGS): |
35 def Generate_C(self, buildpath, varlist, IECCFLAGS): |
34 |
36 |
35 plc_python_filepath = os.path.join( |
37 plc_python_filepath = paths.AbsNeighbourFile(__file__, "plc_python.c") |
36 os.path.split(__file__)[0], "plc_python.c") |
|
37 plc_python_file = open(plc_python_filepath, 'r') |
38 plc_python_file = open(plc_python_filepath, 'r') |
38 plc_python_code = plc_python_file.read() |
39 plc_python_code = plc_python_file.read() |
39 plc_python_file.close() |
40 plc_python_file.close() |
40 python_eval_fb_list = [] |
41 python_eval_fb_list = [] |
41 for v in varlist: |
42 for v in varlist: |