ia64/xen-unstable

view xen/tools/compat-build-source.py @ 13647:057c4c2991fa

32-on-64: Fix an one-off error in compat_addr_ok().
Signed-off-by: Jan Beulich <jbeulich@novell.com>
author kaf24@localhost.localdomain
date Fri Jan 26 13:36:52 2007 +0000 (2007-01-26)
parents b61be7771104
children 08295dc13166
line source
1 #!/usr/bin/python
3 import re,sys
5 pats = [
6 [ r"^\s*#\s*include\s+", r"__InClUdE__ " ],
7 [ r"^\s*#\s*define\s+([A-Z_]*_GUEST_HANDLE)", r"#define HIDE_\1" ],
8 [ r"^\s*#\s*define\s+([a-z_]*_guest_handle)", r"#define hide_\1" ],
9 [ r"XEN_GUEST_HANDLE(_[0-9A-Fa-f]+)?", r"COMPAT_HANDLE" ],
10 ];
12 xlats = []
14 xlatf = open('xlat.lst', 'r')
15 for line in xlatf.readlines():
16 match = re.subn(r"^\s*\?\s+(\w*)\s.*", r"\1", line.rstrip())
17 if match[1]:
18 xlats.append(match[0])
19 xlatf.close()
21 for line in sys.stdin.readlines():
22 for pat in pats:
23 line = re.subn(pat[0], pat[1], line)[0]
24 for xlat in xlats:
25 line = re.subn(r"(struct|union)\s+(%s|xen_%s)\s+(\w)" % (xlat, xlat),
26 r"\1 @KeeP@\2 \3", line.rstrip())[0]
27 print line.rstrip()