win-pvdrivers

view common/include/public/foreign/mkchecker.py @ 62:edd4a2ad5b44

Removed old inf files
author James Harper <james.harper@bendigoit.com.au>
date Wed Dec 19 10:22:50 2007 +1100 (2007-12-19)
parents 5712dede5a1b
children
line source
1 #!/usr/bin/python
3 import sys;
4 from structs import structs;
6 # command line arguments
7 arch = sys.argv[1];
8 outfile = sys.argv[2];
9 archs = sys.argv[3:];
11 f = open(outfile, "w");
12 f.write('''
13 /*
14 * sanity checks for generated foreign headers:
15 * - verify struct sizes
16 *
17 * generated by %s -- DO NOT EDIT
18 */
19 #include <stdio.h>
20 #include <stdlib.h>
21 #include <stddef.h>
22 #include <inttypes.h>
23 #include "../xen.h"
24 ''');
26 for a in archs:
27 f.write('#include "%s.h"\n' % a);
29 f.write('int main(int argc, char *argv[])\n{\n');
31 f.write('\tprintf("\\n");');
32 f.write('printf("%-20s |", "structs");\n');
33 for a in archs:
34 f.write('\tprintf("%%8s", "%s");\n' % a);
35 f.write('\tprintf("\\n");');
37 f.write('\tprintf("\\n");');
38 for struct in structs:
39 f.write('\tprintf("%%-20s |", "%s");\n' % struct);
40 for a in archs:
41 if a == arch:
42 s = struct; # native
43 else:
44 s = struct + "_" + a;
45 f.write('#ifdef %s_has_no_%s\n' % (a, struct));
46 f.write('\tprintf("%8s", "-");\n');
47 f.write("#else\n");
48 f.write('\tprintf("%%8zd", sizeof(struct %s));\n' % s);
49 f.write("#endif\n");
51 f.write('\tprintf("\\n");\n\n');
53 f.write('\tprintf("\\n");\n');
54 f.write('\texit(0);\n');
55 f.write('}\n');
57 f.close();