1323 debug_code = targets.code("plc_debug") % { |
1323 debug_code = targets.code("plc_debug") % { |
1324 "buffer_size": reduce(lambda x, y: x + y, [DebugTypesSize.get(v["type"], 0) for v in self._VariablesList], 0), |
1324 "buffer_size": reduce(lambda x, y: x + y, [DebugTypesSize.get(v["type"], 0) for v in self._VariablesList], 0), |
1325 "programs_declarations": |
1325 "programs_declarations": |
1326 "\n".join(["extern %(type)s %(C_path)s;"%p for p in self._ProgramList]), |
1326 "\n".join(["extern %(type)s %(C_path)s;"%p for p in self._ProgramList]), |
1327 "extern_variables_declarations":"\n".join([ |
1327 "extern_variables_declarations":"\n".join([ |
1328 {"PT":"extern __IEC_%(type)s_p %(C_path)s;", |
1328 {"EXT":"extern __IEC_%(type)s_p %(C_path)s;", |
|
1329 "IN":"extern __IEC_%(type)s_p %(C_path)s;", |
|
1330 "OUT":"extern __IEC_%(type)s_p %(C_path)s;", |
1329 "VAR":"extern __IEC_%(type)s_t %(C_path)s;"}[v["vartype"]]%v |
1331 "VAR":"extern __IEC_%(type)s_t %(C_path)s;"}[v["vartype"]]%v |
1330 for v in self._VariablesList if v["vartype"] != "FB" and v["C_path"].find('.')<0]), |
1332 for v in self._VariablesList if v["vartype"] != "FB" and v["C_path"].find('.')<0]), |
1331 "subscription_table_count": |
1333 "subscription_table_count": |
1332 len(self._VariablesList), |
1334 len(self._VariablesList), |
1333 "variables_pointer_type_table_count": |
1335 "variables_pointer_type_table_count": |
1334 len(self._VariablesList), |
1336 len(self._VariablesList), |
1335 "for_each_variable_do_code":"\n".join([ |
1337 "for_each_variable_do_code":"\n".join([ |
1336 {"PT":" (*fp)((void*)&%(C_path)s,%(type)s_P_ENUM);\n", |
1338 {"EXT":" (*fp)((void*)&%(C_path)s,%(type)s_P_ENUM);\n", |
|
1339 "IN":" (*fp)((void*)&%(C_path)s,%(type)s_P_ENUM);\n", |
|
1340 "OUT":" (*fp)((void*)&%(C_path)s,%(type)s_P_ENUM);\n", |
1337 "VAR":" (*fp)((void*)&%(C_path)s,%(type)s_ENUM);\n"}[v["vartype"]]%v |
1341 "VAR":" (*fp)((void*)&%(C_path)s,%(type)s_ENUM);\n"}[v["vartype"]]%v |
1338 for v in self._VariablesList if v["vartype"] != "FB" and v["type"] in DebugTypes ]), |
1342 for v in self._VariablesList if v["vartype"] != "FB" and v["type"] in DebugTypes ]), |
1339 "find_variable_case_code":"\n".join([ |
1343 "find_variable_case_code":"\n".join([ |
1340 " case %(num)s:\n"%v+ |
1344 " case %(num)s:\n"%v+ |
1341 " *varp = (void*)&%(C_path)s;\n"%v+ |
1345 " *varp = (void*)&%(C_path)s;\n"%v+ |
1342 {"PT":" return %(type)s_P_ENUM;\n", |
1346 {"EXT":" return %(type)s_P_ENUM;\n", |
|
1347 "IN":" return %(type)s_P_ENUM;\n", |
|
1348 "OUT":" return %(type)s_P_ENUM;\n", |
1343 "VAR":" return %(type)s_ENUM;\n"}[v["vartype"]]%v |
1349 "VAR":" return %(type)s_ENUM;\n"}[v["vartype"]]%v |
1344 for v in self._VariablesList if v["vartype"] != "FB" and v["type"] in DebugTypes ])} |
1350 for v in self._VariablesList if v["vartype"] != "FB" and v["type"] in DebugTypes ])} |
1345 |
1351 |
1346 return debug_code |
1352 return debug_code |
1347 |
1353 |