Mesa (master): generate_builtins.py: Clean up generated output a bit.
Kenneth Graunke
kwg at kemper.freedesktop.org
Wed Aug 18 20:17:30 UTC 2010
Module: Mesa
Branch: master
Commit: 011be6b5948e66adb468aef292a7c8e9be600a89
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=011be6b5948e66adb468aef292a7c8e9be600a89
Author: Kenneth Graunke <kenneth at whitecape.org>
Date: Wed Aug 18 13:17:27 2010 -0700
generate_builtins.py: Clean up generated output a bit.
This should make it easier to diff the output, clean up some of the
insane whitespace, and make the strings a bit smaller.
We'll probably need to split up the prototype strings eventually, but
for now, this gets it under the 65K mark.
---
src/glsl/builtins/tools/generate_builtins.py | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/src/glsl/builtins/tools/generate_builtins.py b/src/glsl/builtins/tools/generate_builtins.py
index 2eb67e3..6c38922 100755
--- a/src/glsl/builtins/tools/generate_builtins.py
+++ b/src/glsl/builtins/tools/generate_builtins.py
@@ -38,6 +38,14 @@ def run_compiler(args):
command = [compiler_path, '--dump-lir'] + args
p = Popen(command, 1, stdout=PIPE, shell=False)
output = p.communicate()[0]
+
+ # Clean up output a bit by killing whitespace before a closing paren.
+ kill_paren_whitespace = re.compile(r'[ \n]*\)', re.MULTILINE);
+ output = kill_paren_whitespace.sub(')', output);
+
+ # Also toss any duplicate newlines
+ output = output.replace('\n\n', '\n')
+
return (output, p.returncode)
def write_profile(filename, profile):
@@ -51,6 +59,10 @@ def write_profile(filename, profile):
kill_globals = re.compile(r'^\(declare.*\n', re.MULTILINE);
proto_ir = kill_globals.sub('', proto_ir)
+ # Kill pointer addresses. They're not necessary in prototypes and just
+ # clutter the diff output.
+ proto_ir = re.sub(r'@0x[0-9a-f]+', '', proto_ir);
+
print 'static const char *prototypes_for_' + profile + ' ='
print stringify(proto_ir), ';'
More information about the mesa-commit
mailing list