ia64/xen-unstable

view xen/tools/compat-build-source.py @ 18842:9be2fe3de567

shadow: fix the fix for promotion/resync race.

Signed-off-by: Gianluca Guida <gianluca.guida@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Nov 28 12:02:43 2008 +0000 (2008-11-28)
parents 08295dc13166
children
line source
1 #!/usr/bin/env 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()