plcopen/structures.py
changeset 305 0ed2b61de43e
parent 284 6cf858411d3a
child 307 fd1f6ae26d4f
equal deleted inserted replaced
304:2df3d31d8059 305:0ed2b61de43e
    32                      "W" : ["INT", "UINT", "WORD", "WSTRING"],
    32                      "W" : ["INT", "UINT", "WORD", "WSTRING"],
    33                      "D" : ["DINT", "UDINT", "REAL", "DWORD"],
    33                      "D" : ["DINT", "UDINT", "REAL", "DWORD"],
    34                      "L" : ["LINT", "ULINT", "LREAL", "LWORD"]} 
    34                      "L" : ["LINT", "ULINT", "LREAL", "LWORD"]} 
    35 
    35 
    36 # Helper for emulate join on element list
    36 # Helper for emulate join on element list
    37 def JoinList(separator, list):
    37 def JoinList(separator, mylist):
    38     return reduce(lambda x, y: x + separator + y, list)
    38     if len(mylist) > 0 :
       
    39         return reduce(lambda x, y: x + separator + y, mylist)
       
    40     else :
       
    41         return mylist
    39 
    42 
    40 def generate_block(generator, block, body, link, order=False):
    43 def generate_block(generator, block, body, link, order=False):
    41     body_type = body.getcontent()["name"]
    44     body_type = body.getcontent()["name"]
    42     name = block.getinstanceName()
    45     name = block.getinstanceName()
    43     type = block.gettypeName()
    46     type = block.gettypeName()