debuggers.hg

view tools/include/xen-foreign/mkchecker.py @ 22848:6341fe0f4e5a

Added tag 4.1.0-rc2 for changeset 9dca60d88c63
author Keir Fraser <keir@xen.org>
date Tue Jan 25 14:06:55 2011 +0000 (2011-01-25)
parents 615ee2933137
children
line source
1 #!/usr/bin/python
3 import sys;
4 from structs import structs;
6 # command line arguments
7 outfile = sys.argv[1];
8 archs = sys.argv[2:];
10 f = open(outfile, "w");
11 f.write('''
12 /*
13 * sanity checks for generated foreign headers:
14 * - verify struct sizes
15 *
16 * generated by %s -- DO NOT EDIT
17 */
18 #include <stdio.h>
19 #include <stdlib.h>
20 #include <stddef.h>
21 #include <inttypes.h>
22 ''');
24 for a in archs:
25 f.write('#include "%s.h"\n' % a);
27 f.write('int main(int argc, char *argv[])\n{\n');
29 f.write('\tprintf("\\n");');
30 f.write('printf("%-25s |", "structs");\n');
31 for a in archs:
32 f.write('\tprintf("%%8s", "%s");\n' % a);
33 f.write('\tprintf("\\n");');
35 f.write('\tprintf("\\n");');
36 for struct in structs:
37 f.write('\tprintf("%%-25s |", "%s");\n' % struct);
38 for a in archs:
39 s = struct + "_" + a;
40 f.write('#ifdef %s_has_no_%s\n' % (a, struct));
41 f.write('\tprintf("%8s", "-");\n');
42 f.write("#else\n");
43 f.write('\tprintf("%%8zd", sizeof(struct %s));\n' % s);
44 f.write("#endif\n");
46 f.write('\tprintf("\\n");\n\n');
48 f.write('\tprintf("\\n");\n');
49 f.write('\texit(0);\n');
50 f.write('}\n');
52 f.close();