Commit graph

1,353 commits

Author SHA1 Message Date
Vadim Zeitlin
e1a4b02f69 No real changes, just convert files to Unix EOLs
Some tests and examples files as well as the C manual chapter used DOS EOLs,
get rid of them for consistency with all the other text files.
2016-04-16 00:10:22 +02:00
Vadim Zeitlin
818b399c9e Drastically simplify and optimize object creation and destruction
Don't populate the typenames array for each and every created object and don't
search it when deleting every object, this is O(N) in number of classes and is
completely impractical for any big library where N can easily be several
thousands. Use destructor function which will correctly destroy the object
instead.

Also don't store each created objects in the global registry, there doesn't
seem to be any point in it.

And, in fact, don't bother with the typenames at all, just use another
pseudo-virtual function for checking whether a class inherits from a class
with the given name.

There is unfortunately one problem with the new approach: it doesn't work when
the same C++ type is wrapped under different names as this results in multiple
specializations of SWIG_derives_from<> for this type. But this is a relatively
rare situation (but which does arise in template_default2 unit test, which had
to be disabled) and could be fixed in the future by completely resolving the
type, including the default template parameters values, and checking if
SWIG_derives_from had been already specialized for it. In the meanwhile, this
regression is not a big deal compared to the advantages of the new approach.
2016-04-15 23:25:32 +02:00
Vadim Zeitlin
3d6880aad1 Start removing proxy layer, just use the wrapped functions directly
The proxy layer, and all the extra complexity associated with it, seemed to be
only necessary in order to try to allow using the same name for the wrapped
global functions as were used for them in the original C or C++ code being
wrapped. However this could simply never work in all cases, notably it didn't
work at all when using ELF shared libraries under Unix as the functions with
the same name defined in the main program were interposed and replaced the
functions defined in the shared library, meaning that the proxy function foo()
called wrapper function _wrap_foo() which called back into proxy function
foo() itself again, resulting in guaranteed stack overflow. The only possible
way to fix this would be to use "protected" ELF visibility for the original
functions, but this is not always possible (e.g. if the sources of the
original library are not available) and not simple even when it is and,
besides, protected visibility has its own problems -- notably by making it
impossible to hook the library functions when you actually want to do it.
Besides, proxy-based approach simply couldn't work at all when using static
linking as it resulted in two copies of the function with the same name

Most importantly, however, the main task of this module is to wrap C++
classes, not C functions, and renaming them in the wrapper is not necessary at
all in this case as there is no conflict with the original names in this case.
So simply drop the idea of generating a separate proxy header and generate a
header declaring the functions declared in the wrapper instead and, also, do
not give them "_wrap_" prefix whenever possible, i.e. only do it for the
global functions.

This simplifies SWIG code itself and makes it simpler to use its output as
it's not necessary to link both with the wrapper (dynamically) and with the
proxy (statically) and it's not enough to link with the wrapper only and it
can be done in any way (i.e. either statically or dynamically).

As a side effect of this change, Swig_name_proxy() is not necessary any more
and was removed, eliminating the only difference with the master branch in any
source file other than c.cxx itself.
2016-04-14 02:44:45 +02:00
Vadim Zeitlin
7c402ad148 Merge branch 'master' into C 2016-04-08 17:29:16 +02:00
Simon Marchetto
6c254d1ebb scilab: fix doc (pointer type tracking) 2016-04-06 13:22:59 +02:00
William S Fulton
80e3ebf0d1 html doc fixes 2016-04-02 13:47:23 +01:00
William S Fulton
355f2623c7 Improve documentation for multi-argument typemaps and overloading 2016-04-02 13:44:44 +01:00
Olly Betts
fe56d23f80 Merge pull request #542 from Sajmani/master
Fix Go example in Go.html
2016-03-31 13:07:31 +13:00
William S Fulton
6a1efc6c1d Clearer build and install instructions in the README file for Github users.
Fixes #634.
2016-03-17 20:14:16 +00:00
William S Fulton
ac495d5c66 Merge branch 'char-escaping'
* char-escaping:
  Add missing string_constant.i testcase
  changes file update for char wrappers
  C# char wrappers fixes for enum values, static const member char values and %csconst
  D testing added for %dmanifestconst and char constants
  Fix wrapping D constants using %dmanifestconst
  Php fix for enum value of '\0'
  Fix static const char member variables wrappers with %javaconst(1).
  Expand char testing in enums and %constant
  Java char changes file update
  Java enum and static member variable escaping fix for chars
  Add tests for enum values and static const member variables chars containing escape sequences
  Minor documentation tweak

Conflicts:
	CHANGES.current
2016-03-12 23:27:51 +00:00
William S Fulton
0f0345c214 Merge branch 'interfaces'
* interfaces:
  Documentation and CHANGES entry for interface feature
  interface macro argument name tweaks
  Change the name of the interface in %feature to be more portable
  Interface feature fix for typedef types
  Add limited support for %interface_impl and %shared_ptr
  Multiple inheritance warning wording tweak
  C# "override" fix for "extend" case
  Add checks for interface name symbol clashes
  interface feature test changes for the tests to pass for all languages
  Rename feature_interface.i to swiginterface.i
  Re-organization of the interface feature common code
  Port Java interface tests to C#
  Test %interface
  Test %interface_impl
  Use rstrip instead of regex encoder in %feature_rename
  Add rstrip encoder for use in %rename.
  Interface macros: %interface %interface_impl %interface_custom
  Add $interfacename family of special variable expansions
  Add multiple_inheritance_nspace testcase
  Interface name handling improvements and special variable changes
  Correct regex example comment
  Properly hide unexposed naming functions in naming.c
  C++ namespace testing for interface feature
  interface feature - SWIG_JAVABODY_PROXY does not need to be overridden
  Support namespaces and nspace with the interface feature for C#
  Support namespaces and nspace with the interface feature for Java
  Cosmetic test case changes
  Add Java premature garbage collection prevention parameter (pgcpp) to interface feature
  Create javainterfacecode and csinterfacecode typemaps
  IntPtr & HandleRef absolute names used
  virtual/override fix
  Improve interface feature checks
  Add another interface test selecting just one base as an interface
  Comments added to interface feature implementation and cosmetic code changes
  Add overloading tests for interface feature
  Refactor multiple inheritance warnings
  director generation fixes
  interface feature updates for C# latest on master
  interfaces branch merge fixes
  Remove unnecessary interfaces for concrete classes
  cosmetic code formatting changes
  Correct interface name attributes that are internal
  interface macro changes to support templates
  Test non-virtual method in Derived classes
  interface tests for a most derived class inheriting the interfaces further up the chain
  Rename GetCPtr/getCPtr to SWIGInterfaceUpcast
  interface feature support for const ref pointers (used by the STL)
  Interface feature support for arrays
  More interface feature testing for return values
  interface feature support for passing by value
  interface feature support for references
  Multiple inheritance parameters as pointers testing
  Simplify multiple_inheritance_abstract Java runtime test
  Warning fixes
  Rename test functions in multiple_inheritance_abstract testcase
  Formatting fixes in generated code for interface feature
  Cosmetic spacing changes in test case
  interface feature typemap corrections to handle NULL pointers
  interface test added
  javadirectorin fix
  interface implementation visibility
  interface inheritance (2)
  interface inheritance (1)
  feature:interface ported to Java
  propagate non-abstract "interface" base methods (3)
  propagate non-abstract "interface" base methods (2)
  propagate non-abstract "interface" base methods (1)
  namespace support added GetCPtr now returns HandleRef "feature:interface:name" is now mandatory attribute
  interfaces (1)
  interfaces (1)

Conflicts:
	CHANGES.current
2016-03-11 20:01:41 +00:00
William S Fulton
cd6c8806f0 Documentation and CHANGES entry for interface feature 2016-03-11 19:47:31 +00:00
William S Fulton
21ee09fc19 Multiple inheritance warning wording tweak 2016-03-06 10:45:39 +00:00
William S Fulton
4a3e1fd44c Add rstrip encoder for use in %rename.
This is like the strip encoder but strips the symbol's suffix instead
of the prefix.
2016-03-02 07:11:09 +00:00
Olly Betts
4e9203acc3 Eliminate doc reference to Python 1.4 2016-02-17 14:18:21 +13:00
Karl Wette
290e2d3a5c octave: update manual and CHANGES.current 2016-02-07 20:22:39 +01:00
Karl Wette
9f82bcee2a octave: update manual; Octave operators are __python__ style 2016-02-07 20:22:39 +01:00
William S Fulton
7270da08f4 Merge pull request #585 from tamuratak/master
Fix typo in Ruby docs
2016-02-07 13:19:27 +00:00
Alec Cooper
ba40c4a256 Documentation on Python Bytes/Unicode distinction 2016-02-04 21:07:40 -05:00
Olly Betts
72691e5a49 Clean up Python embed.i
Remove duplicate (aside from comment formatting) embed15.i.

Remove references to Python 1.5.

Tested and remarkably still works with Python 2.7, so update
documentation and comments to reflect that.
2016-01-27 19:01:49 +13:00
William S Fulton
2ad0e784ab Minor documentation tweak 2016-01-26 19:55:10 +00:00
Takashi Tamura
d7f5215eb5 fix typo 2016-01-12 19:52:40 +09:00
Olly Betts
f910607e26 Fix typo: "neccessary" -> "necessary" 2016-01-12 13:37:39 +13:00
Olly Betts
b3bedc210c [Javascript] For v8 >= 4.3.0, use V8_MAJOR_VERSION.
Fixes https://github.com/swig/swig/issues/561.
2016-01-12 09:33:13 +13:00
William S Fulton
a8cf1eddf8 Bump version to 3.0.9 2015-12-31 18:04:16 +00:00
William S Fulton
719c7d532c htmldoc patch no longer needed since pdf docs are now generated by wkhtmltopdf 2015-12-31 18:00:39 +00:00
William S Fulton
ec91de75b7 swig-3.0.8 release update 2015-12-30 22:23:47 +00:00
William S Fulton
28e1a64dcb html docs update 2015-12-30 22:22:33 +00:00
William S Fulton
58279a4627 HTML pdf doc generation fixes
wkhtmltopdf isn't using a fixed-width font for CSS font-family:monospace.
Nor is it using one for <PRE> <CODE> or <TT> elements.
Add in some Courier fonts for it to use - note that Courier 10 Pitch is
installed on Ubuntu by default. Note these fonts need to be installed on
the system that generates the pdf documentation.

Previously the htmldoc stylesheet was kept in place and the SWIG
stylesheet was prepended to it inline in SWIGDocumentation.html.
Now the SWIG stylesheet has been amended with most of the htmldoc
stylesheet changes and completely replaced after htmldoc is run.
2015-12-30 22:22:33 +00:00
William S Fulton
f278fdac59 Replace pdf documentation generation tool with wkhtmltopdf from htmldoc
htmldoc does not seem to be generating pdfs properly any more (on Ubuntu
14.04). It has been replaced with wkhtmltopdf which is better as it
supports css and so the patched version of htmldoc with the simple css
support is no longer required. wkhtmldoc does have have a few problems
though which have been addressed in prior commits:

- <H1><a name="X"></a>Text</H1> style links need changing to:
  <H1><a name="X">Text</a></H1>
- tabs in <pre> elements should be expanded to 8 spaces by default, but
  are expanded to just one space and css expand-tab is not recognised.

The <pre> <tt> <code> elements do not always select a fixed-width font -
try installing a Courier font.
2015-12-30 22:22:33 +00:00
William S Fulton
3763beb489 Replace tabs with spaces in html docs
wkhtmltopdf is not expanding tabs within <pre> elements to 8 spaces as it
should. Workaround the problem by converting all tabs to an appropriate
number of spaces.
2015-12-30 22:22:33 +00:00
William S Fulton
4e67d5c7a8 Minor html fixes 2015-12-30 22:22:33 +00:00
William S Fulton
870b0f1505 html fixes 2015-12-30 22:22:32 +00:00
William S Fulton
925b2a336f HTML fixes for documentation - add meta tag and loose.dtd 2015-12-30 22:22:32 +00:00
William S Fulton
fc68136880 link fixes 2015-12-30 22:22:32 +00:00
William S Fulton
019bdf9067 More link fixes in the docs 2015-12-30 22:22:32 +00:00
William S Fulton
41a02723e6 Remove broken link in docs 2015-12-30 22:22:32 +00:00
William S Fulton
cacb36bedb Docs - remove html tags from headings 2015-12-30 22:22:32 +00:00
William S Fulton
8288ac15a0 Correct links in html documentation using new version of makechap.py
Corrects position of heading text within A and H1, H2, ... elements.
2015-12-30 22:22:32 +00:00
William S Fulton
abe42bbb16 Correct html documentation linking generated by makechap.py script
Corrects position of heading text to be as mentioned in the 4.01
transitional standard, see http://www.w3.org/TR/html4/struct/links.html#h-12.1.1.
For example, changes

<H1><a name="Introduction"></a>2 Introduction</H1>
to
<H1><a name="Introduction">2 Introduction</a></H1>

The changes will convert the old incorrect usage should an html file
using the old approach be added in the future.
2015-12-30 22:22:31 +00:00
William S Fulton
01611702ec Python 2 Unicode strings can be used as inputs to char * or std::string types
Requires SWIG_PYTHON_2_UNICODE to be defined when compiling generated code.
2015-12-19 03:55:26 +00:00
William S Fulton
0ae5bfa6e2 html links updates 2015-12-18 21:14:44 +00:00
William S Fulton
862b4c6138 Add a linkchecker target for checking broken links in SWIGDocumentation.html 2015-12-18 21:14:39 +00:00
William S Fulton
e069365775 html fixes 2015-12-17 13:57:17 +00:00
William S Fulton
64dcd50b99 Remove dependency on yodl tools and remove ccache-swig man page
Use the CCache.html docs instead of the ccache-swig man page.
The yodl2man and yodl2html tools are no longer used and so SWIG no
longer has a dependency on these packages which were required when
building from git.

Closes #286
Closes #128
2015-12-17 02:36:48 +00:00
William S Fulton
51ee23b580 Link to distutils fix 2015-12-05 19:25:18 +00:00
William S Fulton
b69719eb5b changes file note and docs for std::array 2015-11-25 19:20:36 +00:00
Sameer Ajmani
fee8f022e2 Fix Go example in Go.html
Missing "func" keyword.
2015-10-09 17:01:37 -04:00
William S Fulton
803ba97a83 Update docs for shared_ptr 2015-10-01 22:36:01 +01:00
William S Fulton
37e60f450f Ruby tracking doc fixes 2015-09-13 14:53:25 +01:00