ia64/xen-unstable

view xen/tools/compat-build-header.py @ 14858:249de074617f

Added documentation, C bindings, and test for VM_metrics.VCPUs_flags.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Fri Apr 13 18:14:06 2007 +0100 (2007-04-13)
parents 78b7ec4e7b86
children 08295dc13166
line source
1 #!/usr/bin/python
3 import re,sys
5 pats = [
6 [ r"__InClUdE__(.*)", r"#include\1\n#pragma pack(4)" ],
7 [ r"\"xen-compat.h\"", r"<public/xen-compat.h>" ],
8 [ r"(struct|union|enum)\s+(xen_?)?(\w)", r"\1 compat_\3" ],
9 [ r"@KeeP@", r"" ],
10 [ r"_t([^\w]|$)", r"_compat_t\1" ],
11 [ r"(8|16|32|64)_compat_t([^\w]|$)", r"\1_t\2" ],
12 [ r"(^|[^\w])xen_?(\w*)_compat_t([^\w]|$$)", r"\1compat_\2_t\3" ],
13 [ r"(^|[^\w])XEN_?", r"\1COMPAT_" ],
14 [ r"(^|[^\w])Xen_?", r"\1Compat_" ],
15 [ r"(^|[^\w])long([^\w]|$$)", r"\1int\2" ]
16 ];
18 for line in sys.stdin.readlines():
19 for pat in pats:
20 line = re.subn(pat[0], pat[1], line)[0]
21 print line.rstrip()