Commit graph

4,028 commits

Author SHA1 Message Date
William S Fulton
4d4c7eca9a Ruby free function declaration change
Declare function taking void * parameter to be more flexible for upcoming
smart pointer support.
2015-09-14 07:19:57 +01:00
William S Fulton
0ee304188c Merge branch 'lyze-cffi-export-package'
* lyze-cffi-export-package:
  Add user documentation to the export package extension.
  Extend the export feature in the CFFI module to support exporting to a particular package.
2015-09-09 22:32:43 +01:00
Olly Betts
8a6874e633 Fix docstrings for callback functions with -builtin 2015-09-04 15:29:06 +12:00
Olly Betts
8ab622c6d0 [Python] Fix docstrings for %callback functions
Reinstates autodoc for callback function testcase from #467, actually
tests the resulting docstring in the _runme.py and fixes SWIG/Python
so the expected result is obtained.
2015-09-04 13:04:37 +12:00
Olly Betts
efcaa8fdac Drop code to handle compilers lacking the 'bool' type.
SWIG requires an ISO C++ compiler, so this is no longer useful.  Fixes
issue#513.
2015-09-02 09:40:55 +12:00
William S Fulton
567d4690cf Fix ruby warning using clang in director exception code
Suppresses warning:
  error: control may reach end of non-void function [-Werror,-Wreturn-type]
The UNUSED macro is not expanded in ruby.h for rb_exc_raise for clang when
it ought to be.
For patch #512
2015-08-31 14:05:31 +01:00
William S Fulton
01d4bc391c OS X bison warning suppression 2015-08-31 14:05:04 +01:00
Sjoerd Job Postmus
5be177e5c3 Do not use bare exception in generated Python code.
By using the 'except:', you can catch all kinds of exceptions, including
the KeyboardInterrupt and SystemExit exceptions. From the generated
code, it is quite obvious that it is not these cases that should be
caught, but more specific ones like AttributeError and TypeError. To be
on the safe side, I decided to keep using 'Exception' for now.
2015-08-28 17:43:28 +02:00
Joseph C Wang
834a93f449 Revert "Merge pull request #494 from richardbeare/enumR2015B"
This reverts commit cb8973f313, reversing
changes made to ac3284f78c.
2015-08-11 09:57:57 +08:00
joequant
cb8973f313 Merge pull request #494 from richardbeare/enumR2015B
replacement for enumR2015 - tidied and rebased
2015-08-10 13:37:27 +08:00
Richard Beare
da1c6c60d3 This is a modification to support use of tricky enumerations in R. It
includes the addition of a _runme for an existing test - preproc_constants
that was previously not run. That tests includes a preprocessor based
setting of an enumeration which is ignored by the existing r enumeration
infrastructure. The new version correctly reports the enumeration value
as 4 - previous versions set it to 0. Traditional enumerations are unchanged.

The approach used to deal with these enumerations is similar to that of
other languages, and requires a call to a C function at runtime to return
the enumeration value. The previous approach figured out the values statically
and this is still used where possible. The need for a runtime call leads to
changes in when swig code is used in packages - see below.

One test that previously passed now fails - namely the R sourcing of
preproc_constants.R, as the enumeration code requires the shared library,
which isn't loaded by that script.

There is also a modification to the way the R _runme.R files are used.
The call to R CMD BATCH now includes a --args option that indicates
the source folder for the unittest.R file, and the first couple
of lines of the _runme.R files deal with correctly locating this.
Out of source tests now run correctly.

This work was motivated by problems generating the SimpleITK binding,
specifically with some of the more complex enumerations.

This approach does have some issues wrt to code in packages, but I can't
see an alternative. The problem with packages is that the R code setting
up the enumeration structures requires the shared library so that the C
functions returning enumeration values can be called. The enumeration
setup code thus needs to be moved to the package initialisation section.
For SimpleITK I do this using an R script, which I think is an acceptable
solution. The core part of the process is the following function. I dump
all the enumeration stuff into a .onload function. This is only necessary
if some of the enumerations are tricky.

splitSwigFile <- function(filename, onloadfile, mainfile)
{
p1 <- parse(file=filename)

getdefineEnum <- function(X)
{
return (is.call(X) & (X[[1]]=="defineEnumeration"))
}

dd <- sapply(p1, getdefineEnum)

enums <- p1[dd]
enums <- unlist(lapply(enums, deparse))

enums <- c(".onLoad <- function(libname, pkgname) {", enums, "}")

everythingelse <- p1[!dd]
everythingelse <- unlist(lapply(everythingelse, deparse))
writeLines(everythingelse, mainfile)
writeLines(enums, onloadfile)

}
2015-08-10 09:37:04 +10:00
xantares
92328a2016 pep257 & numpydoc conforming docstrings 2015-08-07 22:15:13 +01:00
David Xu
c1fad12bdb Extend the export feature in the CFFI module to support exporting to a particular package. 2015-08-05 21:58:50 -04:00
William S Fulton
c6f8aadc64 Cosmetic corrections - Mac OS X 2015-08-02 20:14:20 +01:00
William S Fulton
00a9b8d3af Merge branch 'docstring-indentation'
* docstring-indentation:
  Improve python code indentation warning / error messages
  Function comment header formatting corrections
  Improve Python docstring indentation handling
2015-07-30 20:17:49 +01:00
Vladimir Kalinin
366e8a9f06 Restored broken ignoring of operators etc. Added more comments.
Added check for explicit $ignore, to allow correct using protected symbols

This is a single commit for patch #476
2015-07-30 08:40:52 +01:00
William S Fulton
e69cc0c0f5 Improve python code indentation warning / error messages 2015-07-30 08:26:17 +01:00
William S Fulton
a779f9bbc1 Function comment header formatting corrections 2015-07-30 08:26:17 +01:00
William S Fulton
fa282b3540 Improve Python docstring indentation handling
SWIG-3.0.5 and earlier sometimes truncated text provided in the docstring
feature.
SWIG-3.0.6 gave a 'Line indented less than expected' error instead of
truncating the docstring text.
Now the indentation for the 'docstring' feature is smarter and is
adjusted so that no truncation occurs.

Closes #475
2015-07-30 08:26:08 +01:00
xantares
812f789db6 Avoid gcc uninitialized variable warnings in Python wrappers.
Just initialize the local array with zeroes.

Closes #453.
2015-07-25 19:10:06 +02:00
William S Fulton
457e0bfa81 Typemap attribute fixes
Fix for breakages in previous few commits:
- Perl test-suite - the "varout" typemap "type" attribute is now
  expanded in typemap.c instead of Perl.cxx.
- The swig_typemap_warn errors testcase showed that $1 was no longer
  being expanded correctly when used in output typemaps (lname not set).
2015-07-24 00:32:46 +01:00
William S Fulton
beabf61ef6 Merge branch 'LindleyF-typemap-in-descriptor'
* LindleyF-typemap-in-descriptor:
  Add documentation and CHANGES for special variables and typemap attributes.
  Support special variable expansion in special variable macros in typemap attributes.
  Enable variable and typemap substitution in typemap kwargs, and a test that verifies this works for directorin:descriptor.
2015-07-22 23:44:58 +01:00
William S Fulton
2f00f6c8cc Support special variable expansion in special variable macros in typemap attributes.
Add test cases for special variable expansions and special variable
macros (aka embedded typemaps) expansion.
2015-07-22 22:04:35 +01:00
Lindley French
94f683868a Enable variable and typemap substitution in typemap kwargs, and a test that verifies this works for directorin:descriptor. 2015-07-22 11:31:21 -07:00
Vladimir Kalinin
c7e4c2d418 refactoring: 2 ways of ignoring symbol in add_symbols() merged for clarity 2015-07-22 15:40:13 +03:00
Vladimir Kalinin
6915061b7d explicitly %ignore'd symbol does not get feature:ignore if it is only added to C symbol table 2015-07-21 19:30:44 +03:00
William S Fulton
a00ab42f80 Merge branch 'm7thon-issue-445-python-class-docstrings'
* m7thon-issue-445-python-class-docstrings:
  Add changes note for Python tp_doc slot and docstring
  Set class docstring in tp_doc slot for python -builtin

Conflicts:
	CHANGES.current
2015-07-18 00:14:37 +01:00
Anbiru Shouta
977240b3f4 Clearer variable name in Java director generated code
Closes #463
2015-07-17 22:34:08 +01:00
William S Fulton
64652523d5 warning fixes 2015-07-17 18:18:44 +01:00
William S Fulton
8ccf639f42 String / char * usage in parser fixes 2015-07-17 18:14:25 +01:00
William S Fulton
2e03845be8 const char * fixes in the parser 2015-07-17 17:50:11 +01:00
Michael Thon
7ed63b11d7 Set class docstring in tp_doc slot for python -builtin 2015-07-09 02:05:33 +02:00
William S Fulton
3718b810c7 Don't generate constructor wrappers if a base class has a private constructor
g++-5 errors out with this now with errors such as:

default_constructor_wrap.cxx:665:27: error: use of deleted function ‘FFF::FFF()’
   result = (FFF *)new FFF();
                           ^
default_constructor_wrap.cxx:314:7: note: ‘FFF::FFF()’ is implicitly deleted because the default definition would be ill-formed:
 class FFF : public F {
       ^
default_constructor_wrap.cxx:301:4: error: ‘F::~F()’ is private
    ~F() { }
    ^
default_constructor_wrap.cxx:314:7: error: within this context
2015-07-07 20:15:55 +01:00
William S Fulton
fb2b1af2e7 Warning fixes for 64bit visual c++ on Windows 2015-07-03 20:59:24 +01:00
William S Fulton
edcdaaec16 Warning fixes for 64bit visual c++ on Windows 2015-07-03 20:59:24 +01:00
Nils Gladitz
925cec3a82 Add a space between literal and string macro
In C++11 a space between a literal and string macro is required.
2015-07-03 20:59:23 +01:00
William S Fulton
05397cf6a2 Fix syntax error when the template keyword is used in types
For example:
  std::template vector<int> v;
2015-07-02 19:23:37 +01:00
Olly Betts
822b2355c0 Improve handling of whitespace in %pythoncode
Previously SWIG looked at the indentation of the first line and removed
that many characters from each subsequent line, regardless of what those
characters were.  This was made worse because SWIG's preprocessor removes
any whitespace before a '#'.  Fixes github issue #379, reported by Joe
Orton.
2015-06-29 22:12:38 +12:00
Simon Marchetto
b05f0057ca improve support of varargs 2015-06-23 16:24:35 +02:00
William S Fulton
0b436c65ca Cosmetic parser change
Rename typemap_parameter_declarator as it is no longer just used for typemaps
2015-06-22 07:04:34 +01:00
William S Fulton
6890dfa881 Fix parse errors for C++11 type aliasing
Recently introduced by the fix for C++11 type aliasing seg fault - 117f6d00
2015-06-22 07:04:34 +01:00
Ian Lance Taylor
11d8403c3c [Go] Fix member variables in base classes to handle CWRAP_NATURAL_VAR
correctly.  Add a test case for the problem.

Fixes #339.
2015-06-20 17:42:44 -07:00
William S Fulton
53b7659ebf Fix Python pep8 warning when using -fastinit (or -O)
Fixes: E231 missing whitespace after ','
2015-06-16 08:11:29 +01:00
William S Fulton
180e21269d Fix python -builtin -O and overloaded functions
More specifically fixes compile errors using -builtin -fastunpack -modernargs.
Recent regression (416277b). Closes #436.
2015-06-16 07:59:22 +01:00
William S Fulton
b94820adcf Fix r.cxx build break 2015-06-12 23:37:08 +01:00
William S Fulton
9b2bde403b R - Remove constantWrapper message wrapping constants
An implementation is still needed for constants.
2015-06-12 20:26:24 +01:00
William S Fulton
cc6970e21f Documentation improvements for -o and -oh options 2015-06-12 06:32:58 +01:00
William S Fulton
8bd6e596d1 Cosmetics - remove references to Java in C# module 2015-06-11 19:39:51 +01:00
William S Fulton
6ab1ab57dd Merge branch 'Sghirate-master' - C# -outfile option
* Sghirate-master:
  changes file update for -outfile
  Add in all C# command line options to the docs
  C# -outfile cosmetic code fixes
  [C#] Single file mode (fixes)
  [C#] Single file mode (minor fix)
  [C#] Single file mode

Conflicts:
	CHANGES.current
2015-06-11 07:53:30 +01:00
William S Fulton
2b9b007027 C# -outfile cosmetic code fixes 2015-06-11 07:42:50 +01:00