70 - The data type |
70 - The data type |
71 - The default modifier which can be "none", "negated", "rising" or "falling" |
71 - The default modifier which can be "none", "negated", "rising" or "falling" |
72 """ |
72 """ |
73 |
73 |
74 StdBlckLibs = {libname: LoadProject(tc6fname)[0] |
74 StdBlckLibs = {libname: LoadProject(tc6fname)[0] |
75 for libname, tc6fname in StdTC6Libs} |
75 for libname, tc6fname in StdTC6Libs} |
76 StdBlckLst = [{"name": libname, "list": |
76 StdBlckLst = [{"name": libname, "list": |
77 [GetBlockInfos(pous) for pous in lib.getpous()]} |
77 [GetBlockInfos(pous) for pous in lib.getpous()]} |
78 for libname, lib in StdBlckLibs.iteritems()] |
78 for libname, lib in StdBlckLibs.iteritems()] |
79 |
79 |
80 #------------------------------------------------------------------------------- |
80 #------------------------------------------------------------------------------- |
81 # Test identifier |
81 # Test identifier |
82 #------------------------------------------------------------------------------- |
82 #------------------------------------------------------------------------------- |
83 |
83 |
243 # apply filter given in "filter" column |
243 # apply filter given in "filter" column |
244 filter_name = Function_decl["filter"] |
244 filter_name = Function_decl["filter"] |
245 store = True |
245 store = True |
246 for (InTypes, OutTypes) in ANY_TO_ANY_FILTERS.get(filter_name, []): |
246 for (InTypes, OutTypes) in ANY_TO_ANY_FILTERS.get(filter_name, []): |
247 outs = reduce(lambda a, b: a or b, |
247 outs = reduce(lambda a, b: a or b, |
248 map(lambda testtype: IsOfType( |
248 map(lambda testtype: IsOfType( |
249 Function_decl["outputs"][0][1], |
249 Function_decl["outputs"][0][1], |
250 testtype), OutTypes)) |
250 testtype), OutTypes)) |
251 inps = reduce(lambda a, b: a or b, |
251 inps = reduce(lambda a, b: a or b, |
252 map(lambda testtype: IsOfType( |
252 map(lambda testtype: IsOfType( |
253 Function_decl["inputs"][0][1], |
253 Function_decl["inputs"][0][1], |
254 testtype), InTypes)) |
254 testtype), InTypes)) |
255 if inps and outs and Function_decl["outputs"][0][1] != Function_decl["inputs"][0][1]: |
255 if inps and outs and Function_decl["outputs"][0][1] != Function_decl["inputs"][0][1]: |
256 store = True |
256 store = True |
257 break |
257 break |
258 else: |
258 else: |
259 store = False |
259 store = False |
276 for desc in section["list"]: |
276 for desc in section["list"]: |
277 words = desc["comment"].split('"') |
277 words = desc["comment"].split('"') |
278 if len(words) > 1: |
278 if len(words) > 1: |
279 desc["comment"] = words[1] |
279 desc["comment"] = words[1] |
280 desc["usage"] = ("\n (%s) => (%s)" % |
280 desc["usage"] = ("\n (%s) => (%s)" % |
281 (", ".join(["%s:%s" % (input[1], input[0]) |
281 (", ".join(["%s:%s" % (input[1], input[0]) |
282 for input in desc["inputs"]]), |
282 for input in desc["inputs"]]), |
283 ", ".join(["%s:%s" % (output[1], output[0]) |
283 ", ".join(["%s:%s" % (output[1], output[0]) |
284 for output in desc["outputs"]]))) |
284 for output in desc["outputs"]]))) |
285 BlkLst = StdBlckDct.setdefault(desc["name"], []) |
285 BlkLst = StdBlckDct.setdefault(desc["name"], []) |
286 BlkLst.append((section["name"], desc)) |
286 BlkLst.append((section["name"], desc)) |
287 |
287 |
288 #------------------------------------------------------------------------------- |
288 #------------------------------------------------------------------------------- |
289 # Languages Keywords |
289 # Languages Keywords |
322 SFC_BLOCK_END_KEYWORDS = ["END_ACTION", "END_STEP", "END_TRANSITION"] |
322 SFC_BLOCK_END_KEYWORDS = ["END_ACTION", "END_STEP", "END_TRANSITION"] |
323 SFC_KEYWORDS = ["FROM", "TO"] + SFC_BLOCK_START_KEYWORDS + SFC_BLOCK_END_KEYWORDS |
323 SFC_KEYWORDS = ["FROM", "TO"] + SFC_BLOCK_START_KEYWORDS + SFC_BLOCK_END_KEYWORDS |
324 |
324 |
325 |
325 |
326 # Keywords for Instruction List |
326 # Keywords for Instruction List |
327 IL_KEYWORDS = ["TRUE", "FALSE", "LD", "LDN", "ST", "STN", "S", "R", "AND", "ANDN", "OR", "ORN", |
327 IL_KEYWORDS = [ |
328 "XOR", "XORN", "NOT", "ADD", "SUB", "MUL", "DIV", "MOD", "GT", "GE", "EQ", "NE", |
328 "TRUE", "FALSE", "LD", "LDN", "ST", "STN", "S", "R", "AND", "ANDN", "OR", "ORN", |
329 "LE", "LT", "JMP", "JMPC", "JMPCN", "CAL", "CALC", "CALCN", "RET", "RETC", "RETCN"] |
329 "XOR", "XORN", "NOT", "ADD", "SUB", "MUL", "DIV", "MOD", "GT", "GE", "EQ", "NE", |
|
330 "LE", "LT", "JMP", "JMPC", "JMPCN", "CAL", "CALC", "CALCN", "RET", "RETC", "RETCN" |
|
331 ] |
330 |
332 |
331 |
333 |
332 # Keywords for Structured Text |
334 # Keywords for Structured Text |
333 ST_BLOCK_START_KEYWORDS = ["IF", "ELSIF", "ELSE", "CASE", "FOR", "WHILE", "REPEAT"] |
335 ST_BLOCK_START_KEYWORDS = ["IF", "ELSIF", "ELSE", "CASE", "FOR", "WHILE", "REPEAT"] |
334 ST_BLOCK_END_KEYWORDS = ["END_IF", "END_CASE", "END_FOR", "END_WHILE", "END_REPEAT"] |
336 ST_BLOCK_END_KEYWORDS = ["END_IF", "END_CASE", "END_FOR", "END_WHILE", "END_REPEAT"] |
335 ST_KEYWORDS = ["TRUE", "FALSE", "THEN", "OF", "TO", "BY", "DO", "DO", "UNTIL", "EXIT", |
337 ST_KEYWORDS = [ |
336 "RETURN", "NOT", "MOD", "AND", "XOR", "OR"] + ST_BLOCK_START_KEYWORDS + ST_BLOCK_END_KEYWORDS |
338 "TRUE", "FALSE", "THEN", "OF", "TO", "BY", "DO", "DO", "UNTIL", "EXIT", |
|
339 "RETURN", "NOT", "MOD", "AND", "XOR", "OR" |
|
340 ] + ST_BLOCK_START_KEYWORDS + ST_BLOCK_END_KEYWORDS |
337 |
341 |
338 # All the keywords of IEC |
342 # All the keywords of IEC |
339 IEC_BLOCK_START_KEYWORDS = [] |
343 IEC_BLOCK_START_KEYWORDS = [] |
340 IEC_BLOCK_END_KEYWORDS = [] |
344 IEC_BLOCK_END_KEYWORDS = [] |
341 IEC_KEYWORDS = ["E", "TRUE", "FALSE"] |
345 IEC_KEYWORDS = ["E", "TRUE", "FALSE"] |