h.py 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. """
  4. Generate .h file.
  5. """
  6. __author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
  7. __copyright__ = "Copyright 2012, Lluís Vilanova <vilanova@ac.upc.edu>"
  8. __license__ = "GPL version 2 or (at your option) any later version"
  9. __maintainer__ = "Stefan Hajnoczi"
  10. __email__ = "stefanha@linux.vnet.ibm.com"
  11. from tracetool import out
  12. def begin(events):
  13. out('/* This file is autogenerated by tracetool, do not edit. */',
  14. '',
  15. '#ifndef TRACE_H',
  16. '#define TRACE_H',
  17. '',
  18. '#include "qemu-common.h"')
  19. def end(events):
  20. for e in events:
  21. if "disable" in e.properties:
  22. enabled = 0
  23. else:
  24. enabled = 1
  25. out('#define TRACE_%s_ENABLED %d' % (e.name.upper(), enabled))
  26. out('',
  27. '#endif /* TRACE_H */')
  28. def nop(events):
  29. for e in events:
  30. out('',
  31. 'static inline void trace_%(name)s(%(args)s)',
  32. '{',
  33. '}',
  34. name = e.name,
  35. args = e.args,
  36. )