canfestival/canfestival.py
changeset 1680 6db967480b7d
parent 1511 91538d0c242c
child 1730 64d8f52bc8c8
equal deleted inserted replaced
1679:2fcea15858a5 1680:6db967480b7d
     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
    21 # You should have received a copy of the GNU General Public License
    22 # You should have received a copy of the GNU General Public License
    22 # along with this program; if not, write to the Free Software
    23 # along with this program; if not, write to the Free Software
    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, sys, shutil
    26 import os, sys, shutil
    26 
    27 import util.paths as paths
    27 base_folder = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
    28 
       
    29 base_folder = paths.AbsParentDir(__file__, 2)
    28 CanFestivalPath = os.path.join(base_folder, "CanFestival-3")
    30 CanFestivalPath = os.path.join(base_folder, "CanFestival-3")
    29 sys.path.append(os.path.join(CanFestivalPath, "objdictgen"))
    31 sys.path.append(os.path.join(CanFestivalPath, "objdictgen"))
    30 
    32 
    31 import wx
    33 import wx
    32 
    34 
   577                    child_data.getCAN_Baudrate())
   579                    child_data.getCAN_Baudrate())
   578             format_dict["nodes_open"] += 'NODE_OPEN(%s)\n    '%(nodename)
   580             format_dict["nodes_open"] += 'NODE_OPEN(%s)\n    '%(nodename)
   579             format_dict["nodes_close"] += 'NODE_CLOSE(%s)\n    '%(nodename)
   581             format_dict["nodes_close"] += 'NODE_CLOSE(%s)\n    '%(nodename)
   580             format_dict["nodes_stop"] += 'NODE_STOP(%s)\n    '%(nodename)
   582             format_dict["nodes_stop"] += 'NODE_STOP(%s)\n    '%(nodename)
   581         
   583         
   582         filename = os.path.join(os.path.split(__file__)[0],"cf_runtime.c")
   584         filename = paths.AbsNeighbourFile(__file__,"cf_runtime.c")
   583         cf_main = open(filename).read() % format_dict
   585         cf_main = open(filename).read() % format_dict
   584         cf_main_path = os.path.join(buildpath, "CF_%(locstr)s.c"%format_dict)
   586         cf_main_path = os.path.join(buildpath, "CF_%(locstr)s.c"%format_dict)
   585         f = open(cf_main_path,'w')
   587         f = open(cf_main_path,'w')
   586         f.write(cf_main)
   588         f.write(cf_main)
   587         f.close()
   589         f.close()