2
0

docs.rst 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. ==================
  2. QEMU Documentation
  3. ==================
  4. QEMU's documentation is written in reStructuredText format and
  5. built using the Sphinx documentation generator. We generate both
  6. the HTML manual and the manpages from the some documentation sources.
  7. hxtool and .hx files
  8. --------------------
  9. The documentation for QEMU command line options and Human Monitor Protocol
  10. (HMP) commands is written in files with the ``.hx`` suffix. These
  11. are processed in two ways:
  12. * ``scripts/hxtool`` creates C header files from them, which are included
  13. in QEMU to do things like handle the ``--help`` option output
  14. * a Sphinx extension in ``docs/sphinx/hxtool.py`` generates rST output
  15. to be included in the HTML or manpage documentation
  16. The syntax of these ``.hx`` files is simple. It is broadly an
  17. alternation of C code put into the C output and rST format text
  18. put into the documention. A few special directives are recognised;
  19. these are all-caps and must be at the beginning of the line.
  20. ``HXCOMM`` is the comment marker. The line, including any arbitrary
  21. text after the marker, is discarded and appears neither in the C output
  22. nor the documentation output.
  23. ``SRST`` starts a reStructuredText section. Following lines
  24. are put into the documentation verbatim, and discarded from the C output.
  25. ``ERST`` ends the documentation section started with ``SRST``,
  26. and switches back to a C code section.
  27. ``DEFHEADING()`` defines a heading that should appear in both the
  28. ``--help`` output and in the documentation. This directive should
  29. be in the C code block. If there is a string inside the brackets,
  30. this is the heading to use. If this string is empty, it produces
  31. a blank line in the ``--help`` output and is ignored for the rST
  32. output.
  33. ``ARCHHEADING()`` is a variant of ``DEFHEADING()`` which produces
  34. the heading only if the specified guest architecture was compiled
  35. into QEMU. This should be avoided in new documentation.
  36. Within C code sections, you should check the comments at the top
  37. of the file to see what the expected usage is, because this
  38. varies between files. For instance in ``qemu-options.hx`` we use
  39. the ``DEF()`` macro to define each option and specify its ``--help``
  40. text, but in ``hmp-commands.hx`` the C code sections are elements
  41. of an array of structs of type ``HMPCommand`` which define the
  42. name, behaviour and help text for each monitor command.
  43. In the file ``qemu-options.hx``, do not try to define a
  44. reStructuredText label within a documentation section. This file
  45. is included into two separate Sphinx documents, and some
  46. versions of Sphinx will complain about the duplicate label
  47. that results.