summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Fonseca <jrfonseca@tungstengraphics.com>2008-11-19 20:06:52 +0900
committerJosé Fonseca <jrfonseca@tungstengraphics.com>2008-11-19 20:06:52 +0900
commit8a9e06257f3a145cddc5e44f841e2f2e81a2cafb (patch)
treeab8363be7521b23df0ac15eb9ba22be3e9ede4ef
parent03f19bc33d0c2e94bf0ad4ec6e42b708be0c0967 (diff)
python/retrace: Fix formatting of shaders.
-rwxr-xr-xsrc/gallium/state_trackers/python/retrace/model.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/gallium/state_trackers/python/retrace/model.py b/src/gallium/state_trackers/python/retrace/model.py
index 3889db4e72..ae0f4327d7 100755
--- a/src/gallium/state_trackers/python/retrace/model.py
+++ b/src/gallium/state_trackers/python/retrace/model.py
@@ -31,6 +31,7 @@
import sys
+import string
import format
try:
@@ -149,10 +150,15 @@ class PrettyPrinter:
self.formatter = formatter
def visit_literal(self, node):
- if isinstance(node.value, str) and len(node.value) > 32:
- self.formatter.text('...')
- else:
- self.formatter.literal(repr(node.value))
+ if isinstance(node.value, basestring):
+ if len(node.value) >= 4096 or node.value.strip(string.printable):
+ self.formatter.text('...')
+ return
+
+ self.formatter.literal('"' + node.value + '"')
+ return
+
+ self.formatter.literal(repr(node.value))
def visit_named_constant(self, node):
self.formatter.literal(node.name)
@@ -193,10 +199,10 @@ class PrettyPrinter:
self.formatter.text(' = ')
value.visit(self)
sep = ', '
+ self.formatter.text(')')
if node.ret is not None:
self.formatter.text(' = ')
node.ret.visit(self)
- self.formatter.text(')')
def visit_trace(self, node):
for call in node.calls: