plugins/c_ext/c_ext.py
changeset 49 45dc6a944ab6
parent 47 fd45c291fed0
child 55 9c26e67c041a
equal deleted inserted replaced
48:6b30cfee163e 49:45dc6a944ab6
   128         current_location = self.GetCurrentLocation()
   128         current_location = self.GetCurrentLocation()
   129         # define a unique name for the generated C file
   129         # define a unique name for the generated C file
   130         location_str = "_".join(map(lambda x:str(x), current_location))
   130         location_str = "_".join(map(lambda x:str(x), current_location))
   131         res = []
   131         res = []
   132         for CFile in self.CFileBaseNames():
   132         for CFile in self.CFileBaseNames():
   133             Gen_Cfile_path = os.path.join(buildpath, location_str + "_" + os.path.splitext(CFile)[0] + "_CFile.c" )
   133             Gen_Cfile_path = os.path.join(buildpath, "CFile_%s_%s.c"%(location_str, os.path.splitext(CFile)[0]))
   134             f = open(Gen_Cfile_path,'w')
   134             f = open(Gen_Cfile_path,'w')
   135             f.write("/* Header generated by Beremiz c_ext plugin */\n")
   135             f.write("/* Header generated by Beremiz c_ext plugin */\n")
   136             f.write("#include \"iec_std_lib.h\"\n")
   136             f.write("#include \"iec_std_lib.h\"\n")
   137             f.write("#define EXT_C_INIT __init_%s\n"%location_str)
   137             f.write("#define EXT_C_INIT __init_%s\n"%location_str)
   138             f.write("#define EXT_C_CLEANUP __init_%s\n"%location_str)
   138             f.write("#define EXT_C_CLEANUP __init_%s\n"%location_str)