]> git.cworth.org Git - apitrace/commitdiff
Strip trailing zeros from bitmasks.
authorJosé Fonseca <jfonseca@vmware.com>
Mon, 4 May 2009 10:05:11 +0000 (11:05 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Mon, 4 May 2009 10:05:11 +0000 (11:05 +0100)
base.py

diff --git a/base.py b/base.py
index 5cf8c77db29548c6b3e61463f3c2fd59b784d488..1f8f1eec4265efa03e0b4997af012b2c54f1ac56 100644 (file)
--- 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):