diff options
author | Emmanuel Ackaouy <ack@xensource.com> | 2007-01-10 17:56:54 +0000 |
---|---|---|
committer | Emmanuel Ackaouy <ack@xensource.com> | 2007-01-10 17:56:54 +0000 |
commit | 2736a406e4eac36a6de7a3b5e08b7f30da038f35 (patch) | |
tree | d469b1f23a86bb92ea03ac598d6b7c1e3278875b /xen/tools/compat-build-source.py | |
parent | 7220350010061dfd1c354397d7a25ec6829ae88a (diff) | |
download | xen-2736a406e4eac36a6de7a3b5e08b7f30da038f35.tar.gz xen-2736a406e4eac36a6de7a3b5e08b7f30da038f35.tar.bz2 xen-2736a406e4eac36a6de7a3b5e08b7f30da038f35.zip |
[XEN] Partial fix for compat build non-portability.
Signed-off-by: John Levon <john.levon@sun.com>
Diffstat (limited to 'xen/tools/compat-build-source.py')
-rwxr-xr-x | xen/tools/compat-build-source.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/xen/tools/compat-build-source.py b/xen/tools/compat-build-source.py new file mode 100755 index 0000000000..449e738188 --- /dev/null +++ b/xen/tools/compat-build-source.py @@ -0,0 +1,27 @@ +#!/usr/bin/python + +import re,sys + +pats = [ + [ r"^\s*#\s*include\s+", r"__InClUdE__ " ], + [ r"^\s*#\s*define\s+([A-Z_]*_GUEST_HANDLE)", r"#define HIDE_\1" ], + [ r"^\s*#\s*define\s+([a-z_]*_guest_handle)", r"#define hide_\1" ], + [ r"XEN_GUEST_HANDLE(_[0-9A-Fa-f]+)?", r"COMPAT_HANDLE" ], +]; + +xlats = [] + +xlatf = open('xlat.lst', 'r') +for line in xlatf.readlines(): + match = re.subn(r"^\s*\?\s+(\w*)\s.*", r"\1", line.rstrip()) + if match[1]: + xlats.append(match[0]) +xlatf.close() + +for line in sys.stdin.readlines(): + for pat in pats: + line = re.subn(pat[0], pat[1], line)[0] + for xlat in xlats: + line = re.subn(r"(struct|union)\s+(%s|xen_%s)\s+(\w)" % (xlat, xlat), + r"\1 @KeeP@\2 \3", line.rstrip())[0] + print line.rstrip() |