source: trunk/packages/xen-3.1/xen-3.1/xen/tools/compat-build-header.py @ 34

Last change on this file since 34 was 34, checked in by hartmans, 17 years ago

Add xen and xen-common

  • Property svn:executable set to *
  • Property svn:mime-type set to text/script
File size: 642 bytes
Line 
1#!/usr/bin/python
2
3import re,sys
4
5pats = [
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];
17
18for line in sys.stdin.readlines():
19    for pat in pats:
20        line = re.subn(pat[0], pat[1], line)[0]
21    print line.rstrip()
Note: See TracBrowser for help on using the repository browser.