summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorNélio Laranjeiro2012-03-12 09:26:27 +0100
committerNélio Laranjeiro2012-04-02 12:45:18 +0200
commit69e0d58d89af7374ea4b31163749148531082285 (patch)
treeb00c35b46f7defc7d6a8a3c074d9bc68d0340555 /common
parentbc5b06b3a7facd5d594c03480c444ee75cc5fe0c (diff)
common/lib/mmtcgen: raise an error if a MMType is duplicated, refs #409
Diffstat (limited to 'common')
-rw-r--r--common/lib/mmtcgen/core.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/common/lib/mmtcgen/core.py b/common/lib/mmtcgen/core.py
index abcf2761fc..52ac0c461f 100644
--- a/common/lib/mmtcgen/core.py
+++ b/common/lib/mmtcgen/core.py
@@ -25,19 +25,18 @@ class MMTypeConstGen:
for c in MMTYPES_MIN_MAX:
if mmtypelist[i].name.startswith(c[0]) \
and (mmtype < c[1] or mmtype > c[2]):
- print "MME Type is outside bounds ", mmtypelist[i].name
- return False
+ msg = "%s has an MME Type outside bounds" \
+ % mmtypelist[i].name
+ raise RuntimeError (msg)
if mmtype & 0x3 != 0:
- print "Base value must be 0x0, 0x4, 0x8, 0xC for ", \
- mmtypelist[i].name
- return False
+ msg = "%s base value must be 0x0, 0x4, 0x8, 0xC" \
+ % mmtypelist[i].name
+ raise RuntimeError (msg)
for j in range (i + 1, len (mmtypelist)):
if mmtypelist[i].value == mmtypelist[j].value:
msg = "Duplicated MMType value for %s %s" % \
(mmtypelist[i].name, mmtypelist[j].name)
- print msg
- return False
- return True
+ raise RuntimeError (msg)
def writeOutputFile (self):
"""Store the parse data into the output file.
@@ -85,7 +84,7 @@ class MMTypeConstGen:
f = open (self.infile, 'r')
self.mmtypelist = parse ('parse', f.read())
f.close ()
- return self.__check_entries (self.mmtypelist)
+ self.__check_entries (self.mmtypelist)
def process (self):
"""Parse and write output file."""