Skip to content

Commit

Permalink
generator.py warns when two elements have the same ID
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob1 committed Oct 31, 2014
1 parent f7b53d0 commit c7bb605
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions generator.py
Expand Up @@ -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])

Expand Down Expand Up @@ -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":
Expand Down

0 comments on commit c7bb605

Please sign in to comment.