Commit graph

3,453 commits

Author SHA1 Message Date
Vadim Zeitlin
16548cced0 Simplify and make more efficient building Python docstrings.
Make the rules for combining explicitly specified docstring, autodoc one and
the one obtained by translating Doxygen comments implicit in the structure of
the code itself instead of writing complicated conditions checking them.

This results in small changes to the whitespace in the generated Python code
when using autodoc, but this makes it PEP 8-compliant, so it is the right
thing to do anyhow.

Also cache the docstring built from translated Doxygen comments. The existing
code seemed to intend to do it, but didn't, really. This helps with
performance generally speaking (-10% for a relatively big library using a lot
of Doxygen comments) and also makes debugging Doxygen translation code less
painful as it's executed only once instead of twice for each comment.

Finally, avoid putting "r", used for Python raw strings, into docstrings in C
code, it is really not needed there.
2014-08-22 17:45:23 +02:00
Vadim Zeitlin
d678891e43 Translate Doxygen code blocks to Sphinx code blocks.
This ensures they are formatted correctly and syntax highlighted (currently
always as C++ code).
2014-08-22 17:45:23 +02:00
Vadim Zeitlin
0f21adf3f9 Add a simple test of multiple parameters to Doxygen test suite.
Ensure that translating more than one @param tag works correctly.
2014-08-22 17:45:23 +02:00
Vadim Zeitlin
bb01e06a6a Make Python parameters types hyperlinks in the doc strings.
It is very useful to be able to click on the parameter types in a function
documentation to go to this parameter description, so always use hyperlink
markup for the parameters of class types, even if not all of them are
necessarily documented -- Sphinx doesn't seem to complain about links to
unknown classes.
2014-08-22 17:45:23 +02:00
Vadim Zeitlin
8b83976f4c Fix arguments of @param, @return etc translations to Python.
For the parameter documentation to be really taken as such, in its entirety,
by Sphinx, it must be indented relative to the :param: tag. Do this by
appending an extra indent after every line of the output and work around the
unnecessary indent of the last line by removing the trailing whitespace.

This required updating the existing tests and removing the expected but not
present any more whitespace from them, but as trailing whitespace in the
documentation is at best insignificant (and at worst harmful) anyhow, this is
not a big price to pay for simpler translator code.
2014-08-22 17:45:22 +02:00
Vadim Zeitlin
14ba3b8dd4 Preserve relative indentation when parsing Doxygen comments.
This is important to preserve the structure of the lists which appear
correctly in Python output without any additional effort if the indentation is
lost.

It is also makes the behaviour consistent for

	/**
	 *
	 *
	 */

comments and those without the asterisks in the middle lines, as now the
indentation is preserved in both cases while it was only preserved when the
asterisks were present previously.
2014-08-22 17:45:22 +02:00
Vadim Zeitlin
ea1d56da67 Use Sphinx-friendly formatting for overloaded functions documentation.
Sphinx doesn't allow sections inside the function documentation and gives tons
of SEVERE warnings for them, so while just emphasizing the "Overload" header
is not ideal, it is better than before because at least the string "Overload"
itself appears in the Sphinx-generated output.
2014-08-22 17:45:22 +02:00
Vadim Zeitlin
eaf63ba47d Add poor man trailing white space detection to Doxygen Python tests.
Show that there is trailing white space in the output in an ugly but
functional way, as without this it's impossible to determine what is the
actual change at all.
2014-08-22 17:45:22 +02:00
Vadim Zeitlin
dd4c680a02 Use Python-ish, not C++, parameter types in Python documentation.
Using C++ types in documentation for Python users is more harmful than
useless, so use Python types whenever possible and allow defining "doctype"
typemap to customize this for the user-defined types.
2014-08-22 17:45:22 +02:00
Vadim Zeitlin
b96dd8bb97 Implement translation of Doxygen formulae to Sphinx notation.
This allows to automatically have nicely looking formulae in HTML output when
using Sphinx with e.g. sphinx.ext.mathjax extension.
2014-08-22 17:45:21 +02:00
Vadim Zeitlin
7d2743a0bb Use reST inline markup in PyDocConverter instead of Markdown.
reST is standard Python markup, so use *...*, ``...`` and so on instead of
_..._, '...' etc.

No other changes even though the mapping of some Doxygen tags to markup used
for them seems suspicions (e.g. \var almost certainly should be the same as
\em).
2014-08-13 16:11:30 +02:00
Vadim Zeitlin
b374aad0da Use Sphinx-compatible docstring format in PyDocConverter.
Use the more or less standard :param:, :type:, :return: and :raises: in the
function/methods descriptions.

Update the output expected from the Python tests accordingly.
2014-08-13 16:11:30 +02:00
Vadim Zeitlin
329d64bb04 Show the diff when a Doxygen test fails.
This is much more readable than just dumping the expected output and the
actual result produced by SWIG, especially for longer Doxygen comments.

Remove the bunch of commented out code and also do not save the results
in the file, this is not very useful as it's not even clear which test the
files correspond to and annoying when these files are left over later. If
anybody really uses this functionality, it ought to be optional.
2014-08-13 16:11:30 +02:00
Vadim Zeitlin
6cce652762 Merge latest master into doxygen branch again.
Update Doxygen-specific Python unit tests to work with the new indentation.

Update one of Doxygen-specific Java tests to still build with the new handling
of srcdir.
2014-08-13 16:11:21 +02:00
Julien Schueller
11b5a61879 Check multi-module examples. Dont use sed. 2014-06-10 08:59:55 +02:00
Julien Schueller
7a4cef998c Enable pep8 check 2014-06-07 13:10:27 +02:00
William S Fulton
ef4cb2f574 Fix example clean target in makefile for operating systems that don't use .so as shared library extension 2014-06-04 13:00:18 +01:00
William S Fulton
1949e2cc63 Fix equality testcase 2014-06-04 12:21:09 +01:00
William S Fulton
c17f77750a Merge pull request #176 from v-for-vandal/lua_eq
Add default __eq implementation for Lua
2014-06-02 19:52:07 +01:00
William S Fulton
81d023ac05 Merge branch 'wkalinin-csymbols-2' - %extend and nested structs
* wkalinin-csymbols-2:
  Add runtime test for %extend and nested union
  test fixed
  %extend symbols for nested structs get into a wrong C symbol table
2014-06-02 07:11:22 +01:00
William S Fulton
5f3ee109c8 Add runtime test for %extend and nested union 2014-06-02 07:09:35 +01:00
Vladimir Kalinin
84e1b553c4 test fixed 2014-05-31 07:59:39 +04:00
Karl Wette
b2d492c15a Octave: use common example.mk for examples, patterned after javascript 2014-05-29 23:42:55 +02:00
Karl Wette
b8026cc02f Fix cleaning of Python runme.py scripts for in-source-tree builds 2014-05-29 14:40:50 +02:00
William S Fulton
b71eb53bae Fix errors test-suite on windows 2014-05-29 11:47:38 +01:00
William S Fulton
42938dc520 Correct infinity testcase 2014-05-29 08:45:56 +01:00
William S Fulton
664c6cc81e Fix infinity testcase on windows 2014-05-29 07:50:21 +01:00
Karl Wette
3fe1eb7056 Set SRCDIR when calling test-suite clean targets, in case it's needed 2014-05-29 02:29:27 +02:00
Karl Wette
cc0738bbda Fully clean Python examples and test-suite 2014-05-29 02:29:27 +02:00
Karl Wette
7f48b2774b Fully clean PHP test-suite 2014-05-29 02:29:27 +02:00
Karl Wette
fca95febde Fully clean Javascript test-suite with jsc and v8 2014-05-29 02:29:27 +02:00
Karl Wette
74e17fdbf6 Fix Javascript examples so that "make clean" works properly with node
- Need to copy example.cxx to build directory so that build products
  end up in the right place; use a gyp command expansion to do so
2014-05-29 02:29:27 +02:00
Karl Wette
32212d5cc0 Fully clean Go test-suite 2014-05-29 02:24:33 +02:00
William S Fulton
78719759d5 Test-suite makefile fixes for Windows
Remove $(realpath ) which is no good for Windows executables running
under Cygwin's make
2014-05-28 23:44:55 +01:00
Vladimir Kalinin
665c4f581b %extend symbols for nested structs get into a wrong C symbol table 2014-05-28 22:15:50 +04:00
Artem Serebriyskiy
46d7645c9a More tests for equality operator overloading 2014-05-28 22:02:47 +04:00
Artem Serebriyskiy
2b4c49d017 Add default __eq implementation
* Renamed SWIG_Lua_equal to SWIG_Lua_class_equal
* If class has no __eq implemented, then default __eq is provided.
  Default __eq compares actual pointers stored inside Lua userdata
2014-05-28 22:01:23 +04:00
William S Fulton
55639cfff0 Merge branch 'hfalcic-master' - Python unicode surrogate escape strings
* hfalcic-master:
  unicode_strings test: manually check values instead of using assert
  unicode_strings_runme.py: fix version check
  unicode_strings test: check return values
  Python unicode_strings test case: restrict to Python > 3.0
  Python 3 'surrogateescape' docs: fix div class for Python code
2014-05-25 12:04:36 +01:00
William S Fulton
597c671e86 More diagnostics for csharp_exceptions testcase for diagnosing erratic failures 2014-05-25 12:00:42 +01:00
William S Fulton
4ab2eb96cd R examples building out-of-source
They still don't run though
2014-05-25 00:29:32 +01:00
Harvey Falcic
91e93838fc unicode_strings test: manually check values instead of using assert 2014-05-24 18:00:04 -04:00
Harvey Falcic
ab527b0e4b unicode_strings_runme.py: fix version check
Python 3.0.1 shouldn't pass.
2014-05-24 17:57:16 -04:00
Harvey Falcic
2533d0210f unicode_strings test: check return values 2014-05-24 16:50:33 -04:00
Harvey Falcic
5c5dfc106f Python unicode_strings test case: restrict to Python > 3.0
Also adjust the test method names and content to match the docs.
2014-05-24 15:39:53 -04:00
William S Fulton
d1f95ab6fd Merge pull request #165 from hfalcic/master
Python 3 byte string output: use errors="surrogateescape"
2014-05-24 17:54:55 +01:00
William S Fulton
ab86f8a8f5 Warning fixes in test-suite 2014-05-24 14:13:24 +01:00
William S Fulton
f39ed94419 Fix compiler warnings in examples when using -std=c++98 -std=gnu89 -pedantic -Wreturn-type 2014-05-24 13:13:32 +01:00
William S Fulton
879296f71b Correct CFLAGS CXXFLAGS for Javascript and guile examples 2014-05-24 13:13:32 +01:00
Harvey Falcic
791f070e66 Add "unicode_strings" test case for new Python 3 behavior 2014-05-23 15:40:01 -04:00
William S Fulton
9e4bce051d Merge branch 'wkalinin-csymbols-1'
* wkalinin-csymbols-1:
  obscure case workaround in std::set wrapper, where ignored type still need to be processed
  global unnamed structures ignored
  test added for nested unnamed C struct %extend
  %extend for nested unnamed C structs
2014-05-20 18:10:41 +01:00