Commit graph

4,084 commits

Author SHA1 Message Date
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
William S Fulton
ac3284f78c Merge branch 'talby--surgical-perlprimtypes-fix'
* talby--surgical-perlprimtypes-fix:
  update CHANGES.current
  check ranges in perlprimtype.swg more carefully to avoid clang warnings
  capture the current behavior of perlprimtypes.swg is more detail
2015-08-09 21:55:30 +01:00
Michael Schaller
608ef60ecf [Go] Renamed 'FooBarAbs' to 'FooBarAbstract' in the documentation and examples. 2015-08-09 14:37:16 +02:00
Michael Schaller
85037c3a33 [Go] Updated the 'callback' and 'extend' examples to match the 'director' one.
After the documentation update on how to utilize the director feature with
commit @17b1c1c the 'callback' and 'extend' examples needed an update as well.
2015-08-09 14:37:16 +02:00
Michael Schaller
a941e5b605 [Go] Revert commit 5e88857 to undelete the 'callback' and 'extend' examples.
The 'callback' and 'extend' examples were presumed to be obsoleted by the new
'director' example.  The examples are helpful though to have similar examples
across target languages and hence the commit @5e88857 which removed these
examples got reverted.
2015-08-09 14:36:58 +02:00
Robert Stone
8ac4a8147b capture the current behavior of perlprimtypes.swg is more detail 2015-08-08 11:39:16 -07:00
xantares
92328a2016 pep257 & numpydoc conforming docstrings 2015-08-07 22:15:13 +01:00
Vadim Zeitlin
a1bddd56eb Make (char*, size_t) typemap usable for strings of other types in Java.
Notably it now works for "unsigned char*" strings.

Add a test to check that it now works in Java and also showing that it already
worked for the other languages with support for this typemap.
2015-08-07 19:44:45 +02:00
Ian Lance Taylor
95a08b3950 [Go] update build instructions in Examples/go/index.html 2015-08-05 07:19:05 -07:00
Michael Schaller
736613e26c [Go] Documentation cleanup of obsolete 'callback' and 'extend' examples.
After commit 17b1c1c (pull request 447; issue 418) the 'callback' and 'extend'
examples have been removed in favor of the 'director' example.
2015-08-05 10:01:15 +02:00
Michael Schaller
d9d26149e7 Some minor changes after first code review by ianlancetaylor.
Renamed overwritenMethodsOnFooBarAbs to overwrittenMethodsOnFooBarAbs.
Changed some line breaks.
2015-08-04 09:50:56 +02:00
Michael Schaller
e47d87e404 Fixed Examples/go/director/Makefile as there might be no copy of director.go during clean if a separate build directory is in use. 2015-08-04 09:34:26 +02:00
Michael Schaller
0db9a6ba7b Fixed Examples/go/director/Makefile as the copy of director.go wasn't cleaned up in separate build directories. 2015-08-04 09:34:26 +02:00
Michael Schaller
afd6a55ce1 Fixed Examples/go/director/Makefile as director.go was missing in separate build directories. 2015-08-04 09:34:26 +02:00
Michael Schaller
a17c9727bd Fleshed out Go's documentation about the director feature and added a director example.
Fixes issues #418.
2015-08-04 09:34:26 +02:00
William S Fulton
9babc26634 Update Scilab test-suite output wording 2015-08-03 08:12:38 +01:00
William S Fulton
c0de963191 Test case warning suppression for visual c++ fix 2015-08-02 22:22:24 +01:00
William S Fulton
892aaf577a Test case warning suppression for visual c++ 2015-08-02 21:50:32 +01:00
William S Fulton
c6f8aadc64 Cosmetic corrections - Mac OS X 2015-08-02 20:14:20 +01:00
William S Fulton
f970d9aae5 testcase warning fix 2015-08-02 19:58:10 +01:00
William S Fulton
a1771cb8a0 Fix potential security exploit in generated Java classes 2015-08-02 11:22:46 +01:00
William S Fulton
e69cc0c0f5 Improve python code indentation warning / error messages 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
William S Fulton
3ab7315cf9 Merge pull request #467 from vadz/no-callback-in-autodoc
Remove callback function from autodoc unit test.
2015-07-24 23:07:54 +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
Vadim Zeitlin
a4b319ce8e Remove callback function from autodoc unit test.
It doesn't seem to belong there at all, there is a dedicated callback unit
test for it and it was added to the initial version of autodoc.i back in
124253d698 without any explanation, so just
remove it.

As this callback was used in a PHP test, perform this test for callback.i now
and use "%(uppercase)s" construct inside %callback to test that this works.
2015-07-19 18:14:06 +02:00
Vadim Zeitlin
08fa873638 Make callback unit test pass for PHP backend.
Deprecated %callback(1) doesn't work with PHP, use "%s" to give the same name
to the callback as to the C function explicitly instead.
2015-07-19 00:13:08 +02:00
Karl Wette
695b88f1ac Merge pull request #460 from opoplawski/octave4
Support for octave 4.0.0
2015-07-17 09:32:28 +02:00
William S Fulton
5a282f3ac3 c++11 test case fixes 2015-07-10 21:50:35 +01:00
Orion Poplawski
1d5d224328 Fix default_constructor_runme.m test 2015-07-10 11:59:45 -06: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
1514e19efb Test-suite fixes for c++11 compilation by g++-5.1 2015-07-06 20:07:23 +01:00
William S Fulton
d325eeee84 Fix incorrect test case code 2015-07-06 19:50:22 +01:00
William S Fulton
fea1bbb188 Testcase workaround for Solaris 2015-07-05 17:16:37 +01:00
William S Fulton
af5906f915 parent_class testcase name warning fixes for PHP 2015-07-05 09:29:47 +01:00
William S Fulton
81f0050135 Perl5 carrays testcase fix
Number of loops is different since seg fault fix in e543299
2015-07-04 23:23:57 +01:00
William S Fulton
41fd7c17e0 Merge branch 'appveyor-check-test-suite'
* appveyor-check-test-suite:
  Appveyor testing expanded
  Fix array overrun in li_carrays testcase
  Warning fixes in generated Python code for 64bit Visual C++ on Windows.
  Warning fixes in generated C# code for 64bit Visual C++ on Windows.
  Warning fixes for 64bit visual c++ on Windows
  Warning fixes in generated Java code for 64bit Visual C++ on Windows.
  Warning fixes for 64bit visual c++ on Windows
  C# gc tests failure fix
  Add a space between literal and string macro
2015-07-04 21:34:42 +01:00
William S Fulton
e543299d97 Fix array overrun in li_carrays testcase 2015-07-04 20:53:49 +01:00
William S Fulton
12dbbf13cc Correct testcase use of typename to be inside a template II 2015-07-04 15:07:38 +01:00
William S Fulton
2b4dda39bb Warning fixes in generated Python code for 64bit Visual C++ on Windows. 2015-07-03 20:59:25 +01:00
William S Fulton
c767b33c3f C# gc tests failure fix
Sometimes the GC just won't run the finalizers, so we output a warning
instead of throwing an error, so now the test-suite will pass but with a
warning if the number of objects is not as expected.

li_std_auto_ptr was failing during Appveyor testing

An equivalent change was put into the corresponding Java runtime tests a
while back.
2015-07-03 20:59:24 +01:00
William S Fulton
335572170b Correct testcase use of typename to be inside a template 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
f1be7ad3ee Merge pull request #452 from ngladitz/lua-char-typemap
lua: push characters as unformatted 1-character strings
2015-07-02 09:35:06 +12:00
Nils Gladitz
ca208cfe35 lua: push characters as unformatted 1-character strings
Since Lua 5.3 the "%c" format character in lua_pushfstring will produce
the string "<\XXX>" (XXX being a decimal code sequence) when
given unprintable characters.

Use lua_pushlstring instead to reproduce the old behavior.
2015-07-01 12:24:12 +02:00
Olly Betts
6528e380cb Fix or workaround PEP8 warnings 2015-06-30 01:36:07 +12: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