c_ext/c_ext.py
changeset 1114 1a97222ffee9
parent 1097 233681f2a00e
child 1119 34db4294c177
equal deleted inserted replaced
1113:16e5b6abd91c 1114:1a97222ffee9
    38         current_location = self.GetCurrentLocation()
    38         current_location = self.GetCurrentLocation()
    39         # define a unique name for the generated C file
    39         # define a unique name for the generated C file
    40         location_str = "_".join(map(str, current_location))
    40         location_str = "_".join(map(str, current_location))
    41         
    41         
    42         text = "/* Code generated by Beremiz c_ext confnode */\n\n"
    42         text = "/* Code generated by Beremiz c_ext confnode */\n\n"
    43         text += "#include <stdio.h>"
    43         text += "#include <stdio.h>\n\n"
    44         
    44         
    45         # Adding includes
    45         # Adding includes
    46         text += "/* User includes */\n"
    46         text += "/* User includes */\n"
    47         text += self.CodeFile.includes.gettext()
    47         text += self.CodeFile.includes.gettext()
    48         text += "\n"
    48         text += "\n"
    49         
    49         
    50         text += '#include "iec_types_all.h"'
    50         text += '#include "iec_types_all.h"\n\n'
    51 
    51         
    52         # Adding variables
    52         # Adding variables
    53         config = self.GetCTRoot().GetProjectConfigNames()[0]
    53         config = self.GetCTRoot().GetProjectConfigNames()[0]
    54         text += "/* User variables reference */\n"
    54         text += "/* User variables reference */\n"
    55         for variable in self.CodeFile.variables.variable:
    55         for variable in self.CodeFile.variables.variable:
    56             var_infos = {
    56             var_infos = {
    63         text += "\n"
    63         text += "\n"
    64         
    64         
    65         # Adding user global variables and routines
    65         # Adding user global variables and routines
    66         text += "/* User internal user variables and routines */\n"
    66         text += "/* User internal user variables and routines */\n"
    67         text += self.CodeFile.globals.gettext()
    67         text += self.CodeFile.globals.gettext()
       
    68         text += "\n"
    68         
    69         
    69         # Adding Beremiz confnode functions
    70         # Adding Beremiz confnode functions
    70         text += "/* Beremiz confnode functions */\n"
    71         text += "/* Beremiz confnode functions */\n"
    71         text += "int __init_%s(int argc,char **argv)\n{\n"%location_str
    72         text += "int __init_%s(int argc,char **argv)\n{\n"%location_str
    72         text += self.CodeFile.initFunction.gettext()
    73         text += self.CodeFile.initFunction.gettext()