779 last_section = line |
779 last_section = line |
780 |
780 |
781 if first_line <= i <= last_line: |
781 if first_line <= i <= last_line: |
782 if last_section is not None: |
782 if last_section is not None: |
783 self.logger.write_warning("In section: " + last_section) |
783 self.logger.write_warning("In section: " + last_section) |
784 last_section = None # only write section once |
784 last_section = None # only write section once |
785 self.logger.write_warning("%04d: %s" % (i, line)) |
785 self.logger.write_warning("%04d: %s" % (i, line)) |
786 |
786 |
787 f.close() |
787 f.close() |
788 |
788 |
789 self.logger.write_error(_("Error : IEC to C compiler returned %d\n") % status) |
789 self.logger.write_error(_("Error : IEC to C compiler returned %d\n") % status) |
857 @return: [(C_file_name, CFLAGS),...] , LDFLAGS_TO_APPEND |
857 @return: [(C_file_name, CFLAGS),...] , LDFLAGS_TO_APPEND |
858 """ |
858 """ |
859 |
859 |
860 return ([(C_file_name, self.plcCFLAGS) |
860 return ([(C_file_name, self.plcCFLAGS) |
861 for C_file_name in self.PLCGeneratedCFiles ], |
861 for C_file_name in self.PLCGeneratedCFiles ], |
862 "", # no ldflags |
862 "", # no ldflags |
863 False) # do not expose retreive/publish calls |
863 False) # do not expose retreive/publish calls |
864 |
864 |
865 def ResetIECProgramsAndVariables(self): |
865 def ResetIECProgramsAndVariables(self): |
866 """ |
866 """ |
867 Reset variable and program list that are parsed from |
867 Reset variable and program list that are parsed from |
868 CSV file generated by IEC2C compiler. |
868 CSV file generated by IEC2C compiler. |
1010 "void __cleanup_%(s)s(void);\n"+ |
1010 "void __cleanup_%(s)s(void);\n"+ |
1011 "void __retrieve_%(s)s(void);\n"+ |
1011 "void __retrieve_%(s)s(void);\n"+ |
1012 "void __publish_%(s)s(void);") % {'s':locstr} for locstr in locstrs]), |
1012 "void __publish_%(s)s(void);") % {'s':locstr} for locstr in locstrs]), |
1013 "retrieve_calls":"\n ".join([ |
1013 "retrieve_calls":"\n ".join([ |
1014 "__retrieve_%s();" % locstr for locstr in locstrs]), |
1014 "__retrieve_%s();" % locstr for locstr in locstrs]), |
1015 "publish_calls":"\n ".join([ #Call publish in reverse order |
1015 "publish_calls":"\n ".join([ #Call publish in reverse order |
1016 "__publish_%s();" % locstrs[i-1] for i in xrange(len(locstrs), 0, -1)]), |
1016 "__publish_%s();" % locstrs[i-1] for i in xrange(len(locstrs), 0, -1)]), |
1017 "init_calls":"\n ".join([ |
1017 "init_calls":"\n ".join([ |
1018 "init_level=%d; " % (i+1)+ |
1018 "init_level=%d; " % (i+1)+ |
1019 "if((res = __init_%s(argc,argv))){" % locstr + |
1019 "if((res = __init_%s(argc,argv))){" % locstr + |
1020 #"printf(\"%s\"); "%locstr + #for debug |
1020 #"printf(\"%s\"); "%locstr + #for debug |
1466 self.IECdebug_lock.acquire() |
1466 self.IECdebug_lock.acquire() |
1467 # If no entry exist, create a new one with a fresh WeakKeyDictionary |
1467 # If no entry exist, create a new one with a fresh WeakKeyDictionary |
1468 IECdebug_data = self.IECdebug_datas.get(IECPath, None) |
1468 IECdebug_data = self.IECdebug_datas.get(IECPath, None) |
1469 if IECdebug_data is None: |
1469 if IECdebug_data is None: |
1470 IECdebug_data = [ |
1470 IECdebug_data = [ |
1471 WeakKeyDictionary(), # Callables |
1471 WeakKeyDictionary(), # Callables |
1472 [], # Data storage [(tick, data),...] |
1472 [], # Data storage [(tick, data),...] |
1473 "Registered", # Variable status |
1473 "Registered", # Variable status |
1474 None, |
1474 None, |
1475 buffer_list] # Forced value |
1475 buffer_list] # Forced value |
1476 self.IECdebug_datas[IECPath] = IECdebug_data |
1476 self.IECdebug_datas[IECPath] = IECdebug_data |
1477 else: |
1477 else: |
1478 IECdebug_data[4] |= buffer_list |
1478 IECdebug_data[4] |= buffer_list |
1579 len(debug_vars) == len(self.TracedIECPath)): |
1579 len(debug_vars) == len(self.TracedIECPath)): |
1580 for IECPath, values_buffer, value in izip( |
1580 for IECPath, values_buffer, value in izip( |
1581 self.TracedIECPath, |
1581 self.TracedIECPath, |
1582 self.DebugValuesBuffers, |
1582 self.DebugValuesBuffers, |
1583 debug_vars): |
1583 debug_vars): |
1584 IECdebug_data = self.IECdebug_datas.get(IECPath, None) #FIXME get |
1584 IECdebug_data = self.IECdebug_datas.get(IECPath, None) #FIXME get |
1585 if IECdebug_data is not None and value is not None: |
1585 if IECdebug_data is not None and value is not None: |
1586 forced = IECdebug_data[2:4] == ["Forced", value] |
1586 forced = IECdebug_data[2:4] == ["Forced", value] |
1587 if not IECdebug_data[4] and len(values_buffer) > 0: |
1587 if not IECdebug_data[4] and len(values_buffer) > 0: |
1588 values_buffer[-1] = (value, forced) |
1588 values_buffer[-1] = (value, forced) |
1589 else: |
1589 else: |