319 block_infos = GetBlockType(SVGUIFB_Types[GetElementType(element)]) |
319 block_infos = GetBlockType(SVGUIFB_Types[GetElementType(element)]) |
320 block_id = element.getid() |
320 block_id = element.getid() |
321 for i, input in enumerate(block_infos["inputs"]): |
321 for i, input in enumerate(block_infos["inputs"]): |
322 element_c_type = CTYPECONVERSION[input[1]] |
322 element_c_type = CTYPECONVERSION[input[1]] |
323 variable = "__Q%s%s_%d_%d"%(TYPECONVERSION[input[1]], current_location, block_id, i + 1) |
323 variable = "__Q%s%s_%d_%d"%(TYPECONVERSION[input[1]], current_location, block_id, i + 1) |
324 text += "%s %s;\n"%(element_c_type, variable) |
324 text += "%s beremiz%s;\n"%(element_c_type, variable) |
|
325 text += "%s* %s = &beremiz%s;\n"%(element_c_type, variable, variable) |
325 text += "%s _copy%s;\n"%(element_c_type, variable) |
326 text += "%s _copy%s;\n"%(element_c_type, variable) |
326 for i, output in enumerate(block_infos["outputs"]): |
327 for i, output in enumerate(block_infos["outputs"]): |
327 element_c_type = CTYPECONVERSION[output[1]] |
328 element_c_type = CTYPECONVERSION[output[1]] |
328 variable = "__I%s%s_%d_%d"%(TYPECONVERSION[output[1]], current_location, block_id, i + 1) |
329 variable = "__I%s%s_%d_%d"%(TYPECONVERSION[output[1]], current_location, block_id, i + 1) |
329 text += "%s %s;\n"%(element_c_type, variable) |
330 text += "%s beremiz%s;\n"%(element_c_type, variable) |
|
331 text += "%s* %s = &beremiz%s;\n"%(element_c_type, variable, variable) |
330 text += "%s _copy%s;\n"%(element_c_type, variable) |
332 text += "%s _copy%s;\n"%(element_c_type, variable) |
331 text +="\n" |
333 text +="\n" |
332 return text |
334 return text |
333 |
335 |
334 def GenerateGlobalVarsAndFuncs(self, size): |
336 def GenerateGlobalVarsAndFuncs(self, size): |
659 for i, output in enumerate(block_infos["outputs"]): |
661 for i, output in enumerate(block_infos["outputs"]): |
660 texts["type"] = TYPECONVERSION[output[1]] |
662 texts["type"] = TYPECONVERSION[output[1]] |
661 texts["pin"] = i + 1 |
663 texts["pin"] = i + 1 |
662 |
664 |
663 variable = "__I%(type)s%(location)s_%(id)d_%(pin)d"%texts |
665 variable = "__I%(type)s%(location)s_%(id)d_%(pin)d"%texts |
664 text +=" %s = _copy%s;\n"%(variable, variable) |
666 text +=" beremiz%s = _copy%s;\n"%(variable, variable) |
665 |
667 |
666 text += """ COMPARE_AND_SWAP_VAL(&in_state_%(id)d, PLC_BUSY, UNCHANGED); |
668 text += """ COMPARE_AND_SWAP_VAL(&in_state_%(id)d, PLC_BUSY, UNCHANGED); |
667 } |
669 } |
668 """%texts |
670 """%texts |
669 text += "}\n\n" |
671 text += "}\n\n" |
679 """%texts |
681 """%texts |
680 for i, input in enumerate(block_infos["inputs"]): |
682 for i, input in enumerate(block_infos["inputs"]): |
681 texts["type"] = TYPECONVERSION[input[1]] |
683 texts["type"] = TYPECONVERSION[input[1]] |
682 texts["pin"] = i + 1 |
684 texts["pin"] = i + 1 |
683 variable = "__Q%(type)s%(location)s_%(id)d_%(pin)d"%texts |
685 variable = "__Q%(type)s%(location)s_%(id)d_%(pin)d"%texts |
684 text += " if (_copy%s != %s) {\n"%(variable, variable) |
686 text += " if (_copy%s != beremiz%s) {\n"%(variable, variable) |
685 text += " _copy%s = %s;\n"%(variable, variable) |
687 text += " _copy%s = beremiz%s;\n"%(variable, variable) |
686 text += " new_state = CHANGED;\n }\n"%texts |
688 text += " new_state = CHANGED;\n }\n"%texts |
687 text += """ COMPARE_AND_SWAP_VAL(&out_state_%(id)d, PLC_BUSY, new_state); |
689 text += """ COMPARE_AND_SWAP_VAL(&out_state_%(id)d, PLC_BUSY, new_state); |
688 refresh |= new_state == CHANGED; |
690 refresh |= new_state == CHANGED; |
689 } |
691 } |
690 """%texts |
692 """%texts |
707 element_type = GetElementType(element) |
709 element_type = GetElementType(element) |
708 texts = {"location" : current_location, "id" : element.getid()} |
710 texts = {"location" : current_location, "id" : element.getid()} |
709 |
711 |
710 text += """ |
712 text += """ |
711 element = (SVGUIElement*)GetElementById(wxT("%(id)d")); |
713 element = (SVGUIElement*)GetElementById(wxT("%(id)d")); |
712 __QX%(location)s_%(id)d_1 = 1; |
714 beremiz__QX%(location)s_%(id)d_1 = 1; |
713 _copy__QX%(location)s_%(id)d_1 = 1; |
715 _copy__QX%(location)s_%(id)d_1 = 1; |
714 __QX%(location)s_%(id)d_2 = 1; |
716 beremiz__QX%(location)s_%(id)d_2 = 1; |
715 _copy__QX%(location)s_%(id)d_2 = 1; |
717 _copy__QX%(location)s_%(id)d_2 = 1; |
716 """%texts |
718 """%texts |
717 if element_type == ITEM_BUTTON: |
719 if element_type == ITEM_BUTTON: |
718 text += " _copy__IX%(location)s_%(id)d_1 = ((SVGUIButton*)element)->GetToggle();\n"%texts |
720 text += " _copy__IX%(location)s_%(id)d_1 = ((SVGUIButton*)element)->GetToggle();\n"%texts |
719 elif element_type == ITEM_TEXT: |
721 elif element_type == ITEM_TEXT: |