The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/xen/interface/foreign/mkchecker.py

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 #!/usr/bin/python
    2 
    3 import sys;
    4 from structs import structs;
    5 
    6 # command line arguments
    7 arch    = sys.argv[1];
    8 outfile = sys.argv[2];
    9 archs   = sys.argv[3:];
   10 
   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 ''');
   25 
   26 for a in archs:
   27     f.write('#include "%s.h"\n' % a);
   28 
   29 f.write('int main(int argc, char *argv[])\n{\n');
   30 
   31 f.write('\tprintf("\\n");');
   32 f.write('printf("%-25s |", "structs");\n');
   33 for a in archs:
   34     f.write('\tprintf("%%8s", "%s");\n' % a);
   35 f.write('\tprintf("\\n");');
   36 
   37 f.write('\tprintf("\\n");');
   38 for struct in structs:
   39     f.write('\tprintf("%%-25s |", "%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");
   50 
   51     f.write('\tprintf("\\n");\n\n');
   52 
   53 f.write('\tprintf("\\n");\n');
   54 f.write('\texit(0);\n');
   55 f.write('}\n');
   56 
   57 f.close();
   58 

Cache object: 2ceeb0d227f6c98bb49efa459c244d01


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.