Merge branch 'vadz-doxygen'

This is the Doxygen work begun in Google Summer of Code projects 2008
and 2012 and subsequently improved by numerous contributors.

* vadz-doxygen: (314 commits)
  Add changes entry for Doxygen support
  Add some missing doctype tyemaps
  Doxygen warnings cleanup
  Move doxygen warning numbers
  Add Python doxygen example
  Doxygen example
  Add Doxygen to include paths
  Doxygen source rename
  More merge fixes from doxygen branches
  Correct python example headers
  Correct source code headers
  Another merge fix from doxygen branches
  Java enums output format fixes
  Add omitted doxygen_parsing_enums testcase
  PEP8 conformance for comment verifier module
  Clean up merge problem
  Doxygen html tweaks
  Update html chapter numbering for added Doxygen chapter
  Fixes to makechap.py to detect ill-formed headers
  html fixes for Doxygen
  Add missing CPlusPlus17.html file
  Format files to unix format
  Doxygen testcase tweak to match that in the html docs
  Doxygen html documentation updates and corrections
  Remove doxygen Examples subdirectory
  Beautify doxygen source code
  Code formatting fixes in doxygen code
  Remove unused doxygen code
  new_node refactor
  Various merge fixes in doxygen branches
  Unused variable warning fix
  Fix wrongly resetting indent after formulae in Doxygen comments
  Add support for doxygen:alias feature
  Get rid of meaningless return type of DoxygenParser methods
  Return enum, not untyped int, when classifying Doxygen commands
  Get rid of unnecessary "typedef enum" in C++ code
  Use slash, not backslash, in "C/C++" in the documentation
  Replace literal "<" with "&lt;" in HTML documentation
  Fix broken link to java.sun.com in Doxygen documentation
  Fix using com.sun.tools.javadoc package under macOS
  Fix error reporting for special characters in Doxygen parsing code
  Switch Python Doxygen unit tests to use inspect.getdoc()
  Use correct separator in Java class path under Windows.
  Remove executable permission from appveyor.yml.
  Use JAVA_HOME value in configure to detect Java.
  Display JAVA_HOME value in "make java_version".
  Fix harmless MSVC warning in DoxygenTranslator code.
  Reset "_last" for all but first enum elements.
  Don't duplicate Javadoc from global enum Doxygen comments twice.
  Move Doxygen comments concatenation from the parser to the lexer.
  Fix shift/reduce conflicts in Doxygen pre/post comment parsing.
  Rewrote part of the grammar dealing with Doxygen comments for enums.
  No changes, just remove spurious white space only differences.
  Move Doxygen comment mangling from the parser to the lexer.
  Merge "-builtin" autodoc bugs workarounds from master into test.
  Quote JAVA_HOME variable value in Java test suite makefile.
  Remove unused C_COMMENT_STRING terminal from the grammar.
  Fix missing returns in the Doxygen test suite code.
  Fix trimming whitespace from Doxygen comments.
  Remove code not doing anything from PyDocConverter.
  Remove unused <sstream> header.
  Remove unreferenced struct declaration.
  Remove unused Swig_warn() function.
  Remove any whitespace before ignored Doxygen commands.
  Remove trailing space from one of Doxygen tests.
  Fix autodoc strings generated in Python builtin case and the test.
  Fix Doxygen unit test in Python "-builtin" case.
  Use class docstrings in "-builtin" Python case.
  Don't indent Doxygen doc strings in generated Python code.
  Add a possibility to flexibly ignore custom Doxygen tags.
  Stop completely ignoring many Doxygen comments.
  Fix structural Doxygen comment recognition in the parser.
  No changes, just make checking for Doxygen structural tags more sane.
  Use "//", not "#", for comments in SWIG input.
  Allow upper case letters and digits in Doxygen words.
  Pass the node the Doxygen comment is attached to to DoxygenParser.
  Get rid of findCommand() which duplicaed commandBelongs().
  Recognize unknown Doxygen tags correctly.
  No real changes, just pass original command to commandBelongs().
  Describe Doxygen-specific %features in a single place.
  Give warnings for unknown Doxygen commands in Doxygen parser.
  Document the return type when translating Doxygen @return to Python.
  Fix translated Doxygen comments for overloaded functions in Python.
  Also merge Doxygen comments for overloaded constructors in Python.
  Allow using enum elements as default values for Python functions.
  Don't always use "*args" for all Python wrapper functions.
  No real changes, just make PYTHON::check_kwargs() const.
  Refactor: move makeParameterName() to common Language base class.
  Remove long line wrapping from Python parameter list generation code.
  Simplify and make more efficient building Python docstrings.
  Translate Doxygen code blocks to Sphinx code blocks.
  Add a simple test of multiple parameters to Doxygen test suite.
  Make Python parameters types hyperlinks in the doc strings.
  Make Language::classLookup() and enumLookup() static.
  Fix arguments of @param, @return etc translations to Python.
  Remove unused method from PyDocConverter.
  No real changes, just remove an unnecessary variable.
  Preserve relative indentation when parsing Doxygen comments.
  Use Sphinx-friendly formatting for overloaded functions documentation.
  Add poor man trailing white space detection to Doxygen Python tests.
  ...
This commit is contained in:
William S Fulton 2018-06-07 08:13:10 +01:00
commit 33921666a1
123 changed files with 12964 additions and 1344 deletions

View file

@ -1,16 +1,14 @@
from autodoc import *
import comment_verifier
import inspect
import sys
def check(got, expected, expected_builtin=None, skip=False):
if not skip:
expect = expected
if is_python_builtin() and expected_builtin != None:
expect = expected_builtin
if expect != got:
raise RuntimeError(
"\n" + "Expected: [" + str(expect) + "]\n" + "Got : [" + str(got) + "]")
comment_verifier.check(got, expect)
def is_new_style_class(cls):
return hasattr(cls, "__class__")
@ -31,97 +29,35 @@ if is_fastproxy(dir()):
# skip builtin check - the autodoc is missing, but it probably should not be
skip = True
check(A.__doc__, "Proxy of C++ A class.", "::A")
check(A.funk.__doc__, "just a string.")
check(A.func0.__doc__,
"func0(self, arg2, hello) -> int",
"func0(arg2, hello) -> int")
check(A.func1.__doc__,
"func1(A self, short arg2, Tuple hello) -> int",
"func1(short arg2, Tuple hello) -> int")
check(A.func2.__doc__,
"\n"
" func2(self, arg2, hello) -> int\n"
"\n"
" Parameters\n"
" ----------\n"
" arg2: short\n"
" hello: int tuple[2]\n"
"\n"
" ",
"\n"
"func2(arg2, hello) -> int\n"
check(inspect.getdoc(A), "Proxy of C++ A class.", "::A")
check(inspect.getdoc(A.funk), "just a string.")
check(inspect.getdoc(A.func0),
"func0(self, arg2, hello) -> int")
check(inspect.getdoc(A.func1),
"func1(A self, short arg2, Tuple hello) -> int")
check(inspect.getdoc(A.func2),
"func2(self, arg2, hello) -> int\n"
"\n"
"Parameters\n"
"----------\n"
"arg2: short\n"
"hello: int tuple[2]\n"
"\n"
""
)
check(A.func3.__doc__,
"\n"
" func3(A self, short arg2, Tuple hello) -> int\n"
"\n"
" Parameters\n"
" ----------\n"
" arg2: short\n"
" hello: int tuple[2]\n"
"\n"
" ",
"\n"
"func3(short arg2, Tuple hello) -> int\n"
"hello: int tuple[2]")
check(inspect.getdoc(A.func3),
"func3(A self, short arg2, Tuple hello) -> int\n"
"\n"
"Parameters\n"
"----------\n"
"arg2: short\n"
"hello: int tuple[2]\n"
"\n"
""
)
"hello: int tuple[2]")
check(A.func0default.__doc__,
"\n"
" func0default(self, e, arg3, hello, f=2) -> int\n"
" func0default(self, e, arg3, hello) -> int\n"
" ",
"\n"
"func0default(e, arg3, hello, f=2) -> int\n"
"func0default(e, arg3, hello) -> int\n"
""
)
check(A.func1default.__doc__,
"\n"
" func1default(A self, A e, short arg3, Tuple hello, double f=2) -> int\n"
" func1default(A self, A e, short arg3, Tuple hello) -> int\n"
" ",
"\n"
"func1default(A e, short arg3, Tuple hello, double f=2) -> int\n"
"func1default(A e, short arg3, Tuple hello) -> int\n"
""
)
check(A.func2default.__doc__,
"\n"
" func2default(self, e, arg3, hello, f=2) -> int\n"
"\n"
" Parameters\n"
" ----------\n"
" e: A *\n"
" arg3: short\n"
" hello: int tuple[2]\n"
" f: double\n"
"\n"
" func2default(self, e, arg3, hello) -> int\n"
"\n"
" Parameters\n"
" ----------\n"
" e: A *\n"
" arg3: short\n"
" hello: int tuple[2]\n"
"\n"
" ",
"\n"
"func2default(e, arg3, hello, f=2) -> int\n"
check(inspect.getdoc(A.func0default),
"func0default(self, e, arg3, hello, f=2) -> int\n"
"func0default(self, e, arg3, hello) -> int")
check(inspect.getdoc(A.func1default),
"func1default(A self, A e, short arg3, Tuple hello, double f=2) -> int\n"
"func1default(A self, A e, short arg3, Tuple hello) -> int")
check(inspect.getdoc(A.func2default),
"func2default(self, e, arg3, hello, f=2) -> int\n"
"\n"
"Parameters\n"
"----------\n"
@ -130,38 +66,15 @@ check(A.func2default.__doc__,
"hello: int tuple[2]\n"
"f: double\n"
"\n"
"func2default(e, arg3, hello) -> int\n"
"func2default(self, e, arg3, hello) -> int\n"
"\n"
"Parameters\n"
"----------\n"
"e: A *\n"
"arg3: short\n"
"hello: int tuple[2]\n"
"\n"
""
)
check(A.func3default.__doc__,
"\n"
" func3default(A self, A e, short arg3, Tuple hello, double f=2) -> int\n"
"\n"
" Parameters\n"
" ----------\n"
" e: A *\n"
" arg3: short\n"
" hello: int tuple[2]\n"
" f: double\n"
"\n"
" func3default(A self, A e, short arg3, Tuple hello) -> int\n"
"\n"
" Parameters\n"
" ----------\n"
" e: A *\n"
" arg3: short\n"
" hello: int tuple[2]\n"
"\n"
" ",
"\n"
"func3default(A e, short arg3, Tuple hello, double f=2) -> int\n"
"hello: int tuple[2]")
check(inspect.getdoc(A.func3default),
"func3default(A self, A e, short arg3, Tuple hello, double f=2) -> int\n"
"\n"
"Parameters\n"
"----------\n"
@ -170,58 +83,21 @@ check(A.func3default.__doc__,
"hello: int tuple[2]\n"
"f: double\n"
"\n"
"func3default(A e, short arg3, Tuple hello) -> int\n"
"func3default(A self, A e, short arg3, Tuple hello) -> int\n"
"\n"
"Parameters\n"
"----------\n"
"e: A *\n"
"arg3: short\n"
"hello: int tuple[2]\n"
"\n"
""
)
"hello: int tuple[2]")
check(A.func0static.__doc__,
"\n"
" func0static(e, arg2, hello, f=2) -> int\n"
" func0static(e, arg2, hello) -> int\n"
" ",
"\n"
check(inspect.getdoc(A.func0static),
"func0static(e, arg2, hello, f=2) -> int\n"
"func0static(e, arg2, hello) -> int\n"
""
)
check(A.func1static.__doc__,
"\n"
" func1static(A e, short arg2, Tuple hello, double f=2) -> int\n"
" func1static(A e, short arg2, Tuple hello) -> int\n"
" ",
"\n"
"func0static(e, arg2, hello) -> int")
check(inspect.getdoc(A.func1static),
"func1static(A e, short arg2, Tuple hello, double f=2) -> int\n"
"func1static(A e, short arg2, Tuple hello) -> int\n"
""
)
check(A.func2static.__doc__,
"\n"
" func2static(e, arg2, hello, f=2) -> int\n"
"\n"
" Parameters\n"
" ----------\n"
" e: A *\n"
" arg2: short\n"
" hello: int tuple[2]\n"
" f: double\n"
"\n"
" func2static(e, arg2, hello) -> int\n"
"\n"
" Parameters\n"
" ----------\n"
" e: A *\n"
" arg2: short\n"
" hello: int tuple[2]\n"
"\n"
" ",
"\n"
"func1static(A e, short arg2, Tuple hello) -> int")
check(inspect.getdoc(A.func2static),
"func2static(e, arg2, hello, f=2) -> int\n"
"\n"
"Parameters\n"
@ -237,31 +113,8 @@ check(A.func2static.__doc__,
"----------\n"
"e: A *\n"
"arg2: short\n"
"hello: int tuple[2]\n"
"\n"
""
)
check(A.func3static.__doc__,
"\n"
" func3static(A e, short arg2, Tuple hello, double f=2) -> int\n"
"\n"
" Parameters\n"
" ----------\n"
" e: A *\n"
" arg2: short\n"
" hello: int tuple[2]\n"
" f: double\n"
"\n"
" func3static(A e, short arg2, Tuple hello) -> int\n"
"\n"
" Parameters\n"
" ----------\n"
" e: A *\n"
" arg2: short\n"
" hello: int tuple[2]\n"
"\n"
" ",
"\n"
"hello: int tuple[2]")
check(inspect.getdoc(A.func3static),
"func3static(A e, short arg2, Tuple hello, double f=2) -> int\n"
"\n"
"Parameters\n"
@ -277,97 +130,78 @@ check(A.func3static.__doc__,
"----------\n"
"e: A *\n"
"arg2: short\n"
"hello: int tuple[2]\n"
"\n"
""
)
"hello: int tuple[2]")
if sys.version_info[0:2] > (2, 4):
# Python 2.4 does not seem to work
check(A.variable_a.__doc__,
check(inspect.getdoc(A.variable_a),
"A_variable_a_get(self) -> int",
"A.variable_a"
)
check(A.variable_b.__doc__,
check(inspect.getdoc(A.variable_b),
"A_variable_b_get(A self) -> int",
"A.variable_b"
)
check(A.variable_c.__doc__,
"\n"
check(inspect.getdoc(A.variable_c),
"A_variable_c_get(self) -> int\n"
"\n"
"Parameters\n"
"----------\n"
"self: A *\n"
"\n",
"self: A *",
"A.variable_c"
)
check(A.variable_d.__doc__,
"\n"
)
check(inspect.getdoc(A.variable_d),
"A_variable_d_get(A self) -> int\n"
"\n"
"Parameters\n"
"----------\n"
"self: A *\n"
"\n",
"self: A *",
"A.variable_d"
)
)
check(B.__doc__,
check(inspect.getdoc(B),
"Proxy of C++ B class.",
"::B"
)
check(C.__init__.__doc__, "__init__(self, a, b, h) -> C", None, skip)
check(D.__init__.__doc__,
check(inspect.getdoc(C.__init__), "__init__(self, a, b, h) -> C", None, skip)
check(inspect.getdoc(D.__init__),
"__init__(D self, int a, int b, Hola h) -> D", None, skip)
check(E.__init__.__doc__,
check(inspect.getdoc(E.__init__),
"__init__(self, a, b, h) -> E\n"
"\n"
" __init__(self, a, b, h) -> E\n"
"__init__(self, a, b, h) -> E\n"
"\n"
" Parameters\n"
" ----------\n"
" a: special comment for parameter a\n"
" b: another special comment for parameter b\n"
" h: enum Hola\n"
"\n"
" ", None, skip
"Parameters\n"
"----------\n"
"a: special comment for parameter a\n"
"b: another special comment for parameter b\n"
"h: enum Hola", None, skip
)
check(F.__init__.__doc__,
check(inspect.getdoc(F.__init__),
"__init__(F self, int a, int b, Hola h) -> F\n"
"\n"
" __init__(F self, int a, int b, Hola h) -> F\n"
"__init__(F self, int a, int b, Hola h) -> F\n"
"\n"
" Parameters\n"
" ----------\n"
" a: special comment for parameter a\n"
" b: another special comment for parameter b\n"
" h: enum Hola\n"
"\n"
" ", None, skip
"Parameters\n"
"----------\n"
"a: special comment for parameter a\n"
"b: another special comment for parameter b\n"
"h: enum Hola", None, skip
)
check(B.funk.__doc__,
"funk(B self, int c, int d) -> int",
"funk(int c, int d) -> int")
check(funk.__doc__, "funk(A e, short arg2, int c, int d) -> int")
check(funkdefaults.__doc__,
"\n"
" funkdefaults(A e, short arg2, int c, int d, double f=2) -> int\n"
" funkdefaults(A e, short arg2, int c, int d) -> int\n"
" ",
"\n"
check(inspect.getdoc(B.funk),
"funk(B self, int c, int d) -> int")
check(inspect.getdoc(funk), "funk(A e, short arg2, int c, int d) -> int")
check(inspect.getdoc(funkdefaults),
"funkdefaults(A e, short arg2, int c, int d, double f=2) -> int\n"
"funkdefaults(A e, short arg2, int c, int d) -> int\n"
""
)
"funkdefaults(A e, short arg2, int c, int d) -> int")
check(func_input.__doc__, "func_input(int * INPUT) -> int")
check(func_output.__doc__, "func_output() -> int")
check(func_inout.__doc__, "func_inout(int * INOUT) -> int")
check(func_cb.__doc__, "func_cb(int c, int d) -> int")
check(banana.__doc__, "banana(S a, S b, int c, Integer d)")
check(inspect.getdoc(func_input), "func_input(int * INPUT) -> int")
check(inspect.getdoc(func_output), "func_output() -> int")
check(inspect.getdoc(func_inout), "func_inout(int * INOUT) -> int")
check(inspect.getdoc(func_cb), "func_cb(int c, int d) -> int")
check(inspect.getdoc(banana), "banana(S a, S b, int c, Integer d)")
check(TInteger.__doc__, "Proxy of C++ T< int > class.", "::T< int >")
check(TInteger.__init__.__doc__, "__init__(TInteger self) -> TInteger", None, skip)
check(TInteger.inout.__doc__,
"inout(TInteger self, TInteger t) -> TInteger",
"inout(TInteger t) -> TInteger")
check(inspect.getdoc(TInteger), "Proxy of C++ T< int > class.", "::T< int >")
check(inspect.getdoc(TInteger.__init__), "__init__(TInteger self) -> TInteger", None, skip)
check(inspect.getdoc(TInteger.inout), "inout(TInteger self, TInteger t) -> TInteger")

View file

@ -0,0 +1,26 @@
def check(got, expected, expected_builtin=None):
if got is None: # Absence of comment is equivalent to empty comment.
got = ''
if got != expected:
import re
p = re.compile(r'^[+-]([^+-].*\S)?(\s+)$', re.M)
def make_trailing_spaces_visible(str):
def replace_trailing_spaces(match):
res = match.group(0)
spaces = match.group(2)
if spaces is not None:
res = res + "{+%d trailing spaces}" % len(spaces)
return res
return re.sub(p, replace_trailing_spaces, str)
from difflib import unified_diff
diff = unified_diff(expected.splitlines(True),
got.splitlines(True), "expected", "got")
lines = []
for line in diff:
line = make_trailing_spaces_visible(line.strip("\r\n"))
lines.append(line + "\n")
raise RuntimeError("Comments don't match:\n" + "".join(lines))

View file

@ -0,0 +1,10 @@
import doxygen_alias
import inspect
import comment_verifier
comment_verifier.check(inspect.getdoc(doxygen_alias.make_something),
"""\
A function returning something.
:rtype: :py:class:`Something`
:return: A new object which may be None.""")

View file

@ -0,0 +1,63 @@
import doxygen_basic_notranslate
import inspect
import string
import sys
import comment_verifier
comment_verifier.check(inspect.getdoc(doxygen_basic_notranslate.function),
r"""\brief
Brief description.
The comment text
\author Some author
\return Some number
\sa function2"""
)
comment_verifier.check(inspect.getdoc(doxygen_basic_notranslate.function2),
r"""A test of a very very very very very very very very very very very very very very very very
very very very very very long comment string."""
)
comment_verifier.check(inspect.getdoc(doxygen_basic_notranslate.function3),
r"""*Overload 1:*
A test for overloaded functions
This is function \b one
|
*Overload 2:*
A test for overloaded functions
This is function \b two"""
)
comment_verifier.check(inspect.getdoc(doxygen_basic_notranslate.function4),
r"""A test of some mixed tag usage
\if CONDITION
This \a code fragment shows us something \.
\par Minuses:
\arg it's senseless
\arg it's stupid
\arg it's null
\warning This may not work as expected
\code
int main() { while(true); }
\endcode
\endif"""
)
comment_verifier.check(inspect.getdoc(doxygen_basic_notranslate.function5),
r"""This is a post comment. """
)
comment_verifier.check(inspect.getdoc(doxygen_basic_notranslate.function6),
r"""Test for default args
@param a Some parameter, default is 42"""
)
comment_verifier.check(inspect.getdoc(doxygen_basic_notranslate.function7),
r"""Test for a parameter with difficult type
(mostly for python)
@param a Very strange param"""
)

View file

@ -0,0 +1,84 @@
import doxygen_basic_translate
import inspect
import string
import sys
import comment_verifier
comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function),
"""\
Brief description.
The comment text.
Author: Some author
:rtype: int
:return: Some number
See also: function2"""
)
comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function2),
"""\
A test of a very very very very very very very very very very very very very very very very
very very very very very long comment string."""
)
comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function3),
"""*Overload 1:*
A test for overloaded functions
This is function **one**
|
*Overload 2:*
A test for overloaded functions
This is function **two**"""
)
comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function4),
"""\
A test of some mixed tag usage
If: CONDITION {
This *code* fragment shows us something .
Title: Minuses:
* it\'s senseless
* it\'s stupid
* it\'s null
Warning: This may not work as expected
.. code-block:: c++
int main() { while(true); }
}"""
)
comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function5),
"""This is a post comment."""
)
comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function6),
"""\
Test for default args
:type a: int
:param a: Some parameter, default is 42"""
)
comment_verifier.check(inspect.getdoc(doxygen_basic_translate.function7),
"""\
Test for a parameter with difficult type
(mostly for python)
:type a: :py:class:`Shape`
:param a: Very strange param"""
)
comment_verifier.check(inspect.getdoc(doxygen_basic_translate.Atan2),
"""\
Multiple parameters test.
:type y: float
:param y: Vertical coordinate.
:type x: float
:param x: Horizontal coordinate.
:rtype: float
:return: Arc tangent of ``y/x``."""
)

View file

@ -0,0 +1,17 @@
import doxygen_ignore
import inspect
import comment_verifier
comment_verifier.check(inspect.getdoc(doxygen_ignore.func),
"""\
A contrived example of ignoring too many commands in one comment.
This is specific to **Python**.
Command ignored, but anything here is still included.""")

View file

@ -0,0 +1,133 @@
import doxygen_misc_constructs
import inspect
import string
import sys
import comment_verifier
comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.getAddress),
r"""Returns address of file line.
:type fileName: int
:param fileName: name of the file, where the source line is located
:type line: int
:param line: line number
:type isGetSize: boolean
:param isGetSize: if set, for every object location both address and size are returned
Connection::getId() """)
comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.CConnectionConfig),
r"""This class contains information for connection to winIDEA. Its methods
return reference to self, so we can use it like this:
CConnectionConfig config = new CConnectionConfig();
config.discoveryPort(5534).dllPath("C:\\myWinIDEA\\connect.dll").id("main");
All parameters are optional. Set only what is required, default values are
used for unspecified parameters.
advancedWinIDEALaunching.py Python example.""")
comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.waitTime),
r"""Determines how long the ``isystem.connect`` should wait for running
instances to respond. Only one of ``lfWaitXXX`` flags from IConnect::ELaunchFlags
may be specified."""
)
comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.getConnection),
r"""This function returns connection id."""
)
comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.getFirstLetter),
r''
)
comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.ClassWithNestedEnum),
r"""Class description."""
)
comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.showList),
r"""An example of a list in a documentation comment.
- The first item of the list.
- The second list item, on
several indented lines,
showing that the indentation
is preserved.
- And the final list item after it.
And this is not a list item any more."""
)
comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.isNoSpaceValidA),
r"""This comment without space after '*' is valid in Doxygen."""
)
comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.isNoSpaceValidB),
r""".This comment without space after '*' is valid in Doxygen."""
)
comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.isNoSpaceValidC),
r''
)
comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.backslashA),
r"""Backslash following``word`` is a valid doxygen command. Output contains
'followingword' with 'word' in code font."""
)
comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.backslashB),
r"""Doxy command without trailing space is ignored - nothing appears
on output. Standalone \ and '\' get to output.
Standalone @ and '@' get to output.
Commands "in quoted \b strings are treated as plain text".
Commands not recognized by Doxygen are ignored.
Backslashes in DOS paths d:and words
following them do not appear on output, we must quote them with
double quotes: "d:\xyz\qwe\myfile", "@something". Single quotes do not help:
'd:'. Escaping works: d:\xyz\qwe\myfile. Unix
paths of course have no such problems: /xyz/qwe/myfile
Commands for escaped symbols:
$ @ \ & ~ < > # % " . :: @text ::text"""
)
comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.backslashC),
r"""Backslash e at end of *line* froze SWIG
*with* old comment parser.
See also: MyClass::fun(char,
float)"""
)
comment_verifier.check(inspect.getdoc(doxygen_misc_constructs.cycle),
r"""The next line contains expression:
['retVal < 10', 'g_counter == 23 && g_mode & 3']
Both words should be emphasized **isystem.connect**.
But not the last period. For **example**, comma should not be emphasized.
Similar **for**: double colon.
Spaces at the start of line should be taken into account:
:type id: int
:param id: used as prefix in log
statements. The default value is empty string, which is OK if
there is only one app. instance. Example:
ctrl.setBP("func1");
If we set the id to ``main_``, we get:
main_ctrl.setBP("func1");
:type fileName: string
:param fileName: name of the log file"""
);

View file

@ -0,0 +1,64 @@
import doxygen_parsing
import inspect
import string
import os
import sys
import comment_verifier
comment_verifier.check(inspect.getdoc(doxygen_parsing.someFunction),
"The function comment")
comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeClass),
"The class comment")
comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeStruct),
"The struct comment")
# There doesn't seem to be any way to specify the doc string for __init__ when
# using "-builtin" (see http://stackoverflow.com/q/11913492/15275), so skip
# this test in this case.
if str(os.environ.get('SWIG_FEATURES')).find('-builtin') == -1:
comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherClass.__init__),
r"""*Overload 1:*
First overloaded constructor.
|
*Overload 2:*
Second overloaded constructor.""")
comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherClass.classMethod),
r"""The class method comment.
SomeAnotherClass#classMethodExtended(int, int) a link text""")
comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherClass.classMethodExtended),
r"""The class method with parameter
:type a: int
:param a: Parameter a
:type b: int
:param b: Parameter b"""
)
comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherClass.classMethodExtended2),
r"""The class method with parameter
:type a: int
:param a: Parameter a
:type b: int
:param b: Parameter b"""
)
comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherStruct.structMethod),
r"""The struct method comment""")
comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherStruct.structMethodExtended),
r"""The struct method with parameter
:type a: int
:param a: Parameter a
:type b: int
:param b: Parameter b"""
)
comment_verifier.check(inspect.getdoc(doxygen_parsing.SomeAnotherStruct.structMethodExtended2),
r"""The struct method with parameter
:type a: int
:param a: Parameter a
:type b: int
:param b: Parameter b""")

View file

@ -0,0 +1,306 @@
import doxygen_translate_all_tags
import inspect
import string
import sys
import comment_verifier
comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func01),
r"""*Hello*
* some list item
This is attention!
You were warned!
Authors: lots of them
Author: Zubr
**boldword**
Some brief description,
extended to many lines.
Not everything works right now...
``codeword``
'citationword'
.. code-block:: c++
some test code""")
comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func02),
r"""Conditional comment: SOMECONDITION
Some conditional comment
End of conditional comment.
Copyright: some copyright
1970 - 2012
Deprecated: Now use another function
This is very large
and detailed description of some thing""")
comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func03),
r"""Comment for **func03()**.
*italicword*
emphazedWord
Example: someFile.txt
Some details on using the example""")
comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func04),
r""":raises: SuperError
:math:`\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}`
.. math::
\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}
.. math::
\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}
This will only appear in hmtl""")
comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func05),
r"""If: ANOTHERCONDITION {
First part of comment
If: SECONDCONDITION {
Nested condition text
}Else if: THIRDCONDITION {
The third condition text
}Else: { The last text block
}
}Else: { Second part of comment
If: CONDITION {
Second part extended
}
}
If not: SOMECONDITION {
This is printed if not
}
Image: testImage.bmp("Hello, world!")
Some text
describing invariant.""")
comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func06),
r"""Comment for **func06()**.
This will only appear in LATeX
* Some unordered list
* With lots of items
* lots of lots of items
someMember Some description follows
This will only appear in man""")
comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func07),
r"""Comment for **func07()**.
Notes: Here
is the note!
This is an overloaded member function, provided for convenience.
It differs from the above function only in what argument(s) it accepts.
someword
Title: The paragraph title
The paragraph text.
Maybe even multiline
:type a: int
:param a: the first param""")
comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func08),
r"""Text after anchor.
'Anchor description'
'someAnchor' not quoted text is not part of ref tag
'someAnchor'
Remarks: Some remark text
Another remarks section
:rtype: void
:return: Whatever
:rtype: void
:return: it
:rtype: void
:return: may return""")
comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func09),
r"""This will only appear in RTF
See also: someOtherMethod
See also: function
Same as
brief description
Since: version 0.0.0.1
:raises: superException
:raises: RuntimeError""")
comment_verifier.check(inspect.getdoc(doxygen_translate_all_tags.func10),
r"""TODO: Some very important task
:type b: float
:param b: B is mentioned again...
very long
text with tags <sometag>
Version: 0.0.0.2
Warning: This is senseless!
This will only appear in XML
Here goes test of symbols:
$ @ \ & ~ < > # % " . ::
And here goes simple text""")

View file

@ -0,0 +1,38 @@
import doxygen_translate_links
import inspect
import string
import sys
import comment_verifier
comment_verifier.check(inspect.getdoc(doxygen_translate_links.function),
r"""Testing typenames converting in @ link
superFunc(int,std::string)
Test for std_string member
superFunc(int,long,void*)
Test for simple types
superFunc(Shape::superType*)
Test for custom types
superFunc(int**[13])
Test for complex types
same works for 'See also:' links:
See also: superFunc(int,std::string)
See also: superFunc(int,long,void*)
See also: superFunc(Shape::superType*)
See also: superFunc(int**[13])
some failing params:
See also: superFunc()
See also: superFunc()
See also: superFunc()""")

View file

@ -0,0 +1,264 @@
import doxygen_translate
import inspect
import string
import sys
import comment_verifier
comment_verifier.check(inspect.getdoc(doxygen_translate.function),
r"""*Hello*
* some list item
Authors: lots of them
Author: Zubr
**boldword**
``codeword``
'citationword'
.. code-block:: c++
some test code
Conditional comment: SOMECONDITION
Some conditional comment
End of conditional comment.
Copyright: some copyright
Deprecated: Now use another function
*italicword*
Example: someFile.txt
Some details on using the example
:raises: SuperError
If: ANOTHERCONDITION {
First part of comment
If: SECONDCONDITION {
Nested condition text
}Else if: THIRDCONDITION {
The third condition text
}Else: { The last text block
}
}Else: { Second part of comment
If: CONDITION {
Second part extended
}
}
If not: SOMECONDITION {
This is printed if not
}
Image: testImage.bmp("Hello, world!")
* Some unordered list
* With lots of items
* lots of lots of items
someMember Some description follows
Notes: Here
is the note!
This is an overloaded member function, provided for convenience.
It differs from the above function only in what argument(s) it accepts.
someword
Title: The paragraph title
The paragraph text.
Maybe even multiline
:type a: int
:param a: the first param
Remarks: Some remark text
Another remarks section
:rtype: int
:return: Whatever
:rtype: int
:return: it
:rtype: int
:return: may return
See also: someOtherMethod
See also: function
Since: version 0.0.0.1
:raises: superException
:raises: RuntimeError
TODO: Some very important task
:type b: float
:param b: B is mentioned again...
very long
text with tags <sometag>
Version: 0.0.0.2
Warning: This is senseless!
Here goes test of symbols:
$ @ \ & ~ < > # % " . ::
And here goes simple text"""
)
comment_verifier.check(inspect.getdoc(doxygen_translate.htmlFunction),
r"""Test for html tags. See Doxygen doc for list of tags recognized by Doxygen.
This is link ("http://acme.com/index.html")
**bold**
Quote:
Quotation block.
("http://www.worldwildlife.org/who/index.html")
center
``this is code``
Starts an item title.
Starts an item description.
Starts a piece of text displayed in a typewriter font.
Starts a section with a specific style (HTML only)
**Starts a piece of text displayed in an italic font.**
'Form' does not generate any output.
--------------------------------------------------------------------
# Heading 1
## Heading 2
### Heading 3
*Starts a piece of text displayed in an italic font.*
Input tag.
Image: src="slika.png"
Meta tag.
Multicol is ignored by doxygen.
* List item 1.
* List item 2.
Starts a new paragraph.
Starts a preformatted fragment.
Starts a section of text displayed in a smaller font.
'Starts an inline text fragment with a specific style.'
**Starts a section of bold text.**
Starts a piece of text displayed in subscript.
Starts a piece of text displayed in superscript.
Animals
| Column 1 | Column 2 |
-----------------------
| cow | dog |
| cat | mouse |
| horse | parrot |
Starts a piece of text displayed in a typewriter font.
Starts a piece of text displayed in a typewriter font.
* List item 1.
* List item 2.
* List item 3.
*Starts a piece of text displayed in an italic font.*
<u>underlined \b bold text - doxy commands are ignored inside 'htmlonly' section </u>""")
comment_verifier.check(inspect.getdoc(doxygen_translate.htmlTableFunction),
r"""The meaning of flags:
:type byFlags: int
:param byFlags: bits marking required items:
| Size in bits| Items Required |
--------------------------------
| 1 - 8 | 1 |
| 9 - 16 | 2 |
| 17 - 32 | 4 |
Almost all combinations of above flags are supported by
``htmlTable...`` functions.""")
comment_verifier.check(inspect.getdoc(doxygen_translate.htmlEntitiesFunction),
r"""All entities are treated as commands (C) TM (R)
should work also<in text
>
&
'
"
`
'
"
"
-
--
x
-
.
~
<=
>=
<--
-->
Not an html entity - ignored by Doxygen.
Not an &text html entity - ampersand is replaced with entity.""")