Permalink
Browse files

generator.py warns when two elements have the same ID

  • Loading branch information...
1 parent f7b53d0 commit c7bb60559e3f1e4cfeef807863a6c7148d793a41 @jacob1 jacob1 committed Oct 31, 2014
Showing with 8 additions and 0 deletions.
  1. +8 −0 generator.py
View
@@ -36,10 +36,14 @@ def generateElements(elementFiles, outputCpp, outputH):
directives.append(match.split(" "))
classDirectives = []
+ usedIDs = []
for d in directives:
if d[0] == "ElementClass":
d[3] = int(d[3])
classDirectives.append(d)
+ if d[3] in usedIDs:
+ print("WARNING: duplicate element ID {} ({})".format(d[3],d[2]))
+ usedIDs.append(d[3])
elementIDs = sorted(classDirectives, key=lambda directive: directive[3])
@@ -168,12 +172,16 @@ def generateTools(toolFiles, outputCpp, outputH):
directives.append(match.split(" "))
classDirectives = []
+ usedIDs = []
for d in directives:
if d[0] == "ToolClass":
toolClasses[d[1]] = []
toolHeader += "#define %s %s\n" % (d[2], d[3])
d[3] = int(d[3])
classDirectives.append(d)
+ if d[3] in usedIDs:
+ print("WARNING: duplicate tool ID {} ({})".format(d[3],d[2]))
+ usedIDs.append(d[3])
for d in directives:
if d[0] == "ToolHeader":

0 comments on commit c7bb605

Please sign in to comment.