summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2012-06-29 16:10:57 +0200
committerFlorian Bruhin <me@the-compiler.org>2012-06-29 16:10:57 +0200
commitfb6be296585e253a9f075b1418c9b8edcbbc604c (patch)
tree0f11ce303042cbd83f21589ccb12d2548a897e69
parent8bc4615acad50e2cf41e9d7aaee5aa588d9aa230 (diff)
downloadxdd2esi-fb6be296585e253a9f075b1418c9b8edcbbc604c.tar.gz
xdd2esi-fb6be296585e253a9f075b1418c9b8edcbbc604c.zip
Don't get max/min values if datatype is None or string
-rw-r--r--xdd2esilib.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/xdd2esilib.py b/xdd2esilib.py
index 9769145..922bcc0 100644
--- a/xdd2esilib.py
+++ b/xdd2esilib.py
@@ -54,8 +54,8 @@ def _xdd2esi(obj):
'pdomapping': _get_pdomapping,
'infocomment': _get_infocomment,
'default': _get_default,
- 'maximum': _get_direct_hex,
- 'minimum': _get_direct_hex,
+ 'maximum': _get_maxmin,
+ 'minimum': _get_maxmin,
'dataorvalue': _get_dataorvalue,
'objflags': _get_direct,
'objecttype': _get_direct,
@@ -150,6 +150,13 @@ def _get_direct_hex(obj, attr):
retval = _inttohex(val)
return retval
+def _get_maxmin(obj, attr):
+ if obj.datatype is None or obj.datatype.type_ == 'string':
+ retval = None
+ else:
+ retval = _get_direct_hex(obj, attr)
+ return retval
+
def _get_dataorvalue(obj, attr):
""" Checks if the object needs [Default|Max|Min]Data or ...Value """
if _is_string(obj):