]> git.cworth.org Git - apitrace/blobdiff - wrappers/trace.py
cgltrace: Fix CGLChoosePixelFormat prototype.
[apitrace] / wrappers / trace.py
index adfc764bff3259df9d12cff8783a721e564f0acb..4b25607879b587c42d39ad97ddb665c47707ae65 100644 (file)
@@ -212,7 +212,8 @@ class ValueSerializer(stdapi.Visitor, stdapi.ExpanderMixin):
         # It is currently assumed that an unknown key means that it is followed by an int value.
 
         # determine the array length which must be passed to writeArray() up front
-        count = '_c' + array.keyType.tag
+        count = '_c' + array.baseType.tag
+        print '    {'
         print '    int %s;' % count
         print '    for (%(c)s = 0; %(array)s && %(array)s[%(c)s] != %(terminator)s; %(c)s += 2) {' \
               % {'c': count, 'array': instance, 'terminator': array.terminator}
@@ -230,10 +231,10 @@ class ValueSerializer(stdapi.Visitor, stdapi.ExpanderMixin):
 
         # for each key / key-value pair write the key and the value, if the key requires one
 
-        index = '_i' + array.keyType.tag
+        index = '_i' + array.baseType.tag
         print '    for (int %(i)s = 0; %(i)s < %(count)s; %(i)s++) {' % {'i': index, 'count': count}
         print '        trace::localWriter.beginElement();'
-        self.visitEnum(array.keyType, "%(array)s[%(i)s]" % {'array': instance, 'i': index})
+        self.visit(array.baseType, "%(array)s[%(i)s]" % {'array': instance, 'i': index})
         print '        trace::localWriter.endElement();'
         print '        if (%(i)s + 1 >= %(count)s) {' % {'i': index, 'count': count}
         print '            break;'
@@ -258,13 +259,14 @@ class ValueSerializer(stdapi.Visitor, stdapi.ExpanderMixin):
         print '        default:'
         print '            trace::localWriter.beginElement();'
         print '            os::log("apitrace: warning: %s: unknown key 0x%04X, interpreting value as int\\n", ' + \
-                           '__FUNCTION__, int(%(array)s[%(i)s]));'  % {'array': instance, 'i': index}
+                           '__FUNCTION__, int(%(array)s[%(i)s - 1]));'  % {'array': instance, 'i': index}
         print '            trace::localWriter.writeSInt(%(array)s[%(i)s]);' % {'array': instance, 'i': index}
         print '            trace::localWriter.endElement();'
         print '            break;'
         print '        }'
         print '    }'
         print '    trace::localWriter.endArray();'
+        print '    }'
 
 
     def visitBlob(self, blob, instance):