summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2009-05-04 11:05:11 +0100
committerJosé Fonseca <jfonseca@vmware.com>2009-05-04 11:05:11 +0100
commit47e85e1627ee44eef1991dff3e32a825d76aec34 (patch)
tree582968b43c7d8639ddac726c839c8d6c2bd64528
parented9c01691f79722a1163059a9e381dba0720cfc8 (diff)
Strip trailing zeros from bitmasks.
-rw-r--r--base.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/base.py b/base.py
index 5cf8c77d..1f8f1eec 100644
--- a/base.py
+++ b/base.py
@@ -203,13 +203,21 @@ class Flags(Concrete):
return str(self.type)
def _dump(self, instance):
+ print ' bool l_First = TRUE;'
print ' %s l_Value = %s;' % (self.type, instance)
for value in self.values:
print ' if((l_Value & %s) == %s) {' % (value, value)
- print ' Log::Text("%s | ");' % value
+ print ' if(!l_First)'
+ print ' Log::Text(" | ");'
+ print ' Log::Text("%s");' % value
print ' l_Value &= ~%s;' % value
+ print ' l_First = FALSE;'
print ' }'
+ print ' if(l_Value || l_First) {'
+ print ' if(!l_First)'
+ print ' Log::Text(" | ");'
self.type.dump("l_Value");
+ print ' }'
class Struct(Concrete):