Support code in std_map.i needs all the template parameters that std::map takes,
even the default ones (Compare, Allocator).
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12759 626c5289-ae23-0410-ae9c-e8d60b6d4f22
in a PHP class wrapper), rather than taking newobject==2 as meaning this,
so we can wrap new and existing objects in this way.
Handle wrapping classes in a C++ namespace being returned by director methods.
No need to force classname to lowercase as zend_lookup_class() does that
internally.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12723 626c5289-ae23-0410-ae9c-e8d60b6d4f22
The Octave run-time allows global operators to be implemented,
e.g. op_scalar_add_X for adding a scalar and a wrapped struct X.
However it doesn't currently seem possible for these operators to
map to SWIG-wrapped functions. This is because dispatch_global_op()
looks for the operators to be installed as global variables, whereas
install_global() installs SWIG-wrapped functions as builtin functions;
the two appear to be separate symbol tables in Octave.
This patch modifies install_global() to install global operator functions
as both builtin functions and as global variables, where the value of the
global variable is a function handle to the operator function. It decides
if a function is a global operator if it begins with the prefix "op_"; this
prefix can be modified through a new command-line variable. It also always
installs the operators globally, regardless of whether the rest of the module
is being loaded globally. To accomplish this, install_global() is now always
called, but takes a bool argument specifying whether it should load symbols
globally. If a function is not a global operator, install_global() should
behave as before.
Tested that this compiles and works on Octave 3.2.4 and 3.4.0.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12675 626c5289-ae23-0410-ae9c-e8d60b6d4f22
The Python operator model, when evaluating e.g. x + y, is to call
x.__add__(y), then y.__radd__(x) if the former does not exist, etc.
This patch adds similar functionality to the SWIG runtime code.
For the special case of the comparison operators __l*__ and __g*__,
the reverse operators are __g*__ and __l*__ respectively.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12674 626c5289-ae23-0410-ae9c-e8d60b6d4f22
According to the Octave changelog (ChangeLog and src/ChangeLog
in the Octave 3.4.0 source), octave_base_value::map_value() now
returns an octave_map instead of an Octave_map; this change dates
from Octave API version 40 onward. This patch makes the necessary
changes to the SWIG runtime while remaining backward-compatible.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12673 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Uses Octave's indentation functions to make sure the classes are
printed at the correct indentation level, e.g. for a cell array
containing SWIG-wrapped classes.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12672 626c5289-ae23-0410-ae9c-e8d60b6d4f22
* replace PyObject with octave_value in the SWIG_AsVal(float) fragment
* modify %swig_fromcplx_conv to use the correct Octave constructor for
double (Complex) and float (FloatComplex)
Also remove an unneeded %ifcplusplus (Octave wrapping code is always in C++).
Checked that %swig_cplxflt_convn now compiles correctly for single-precision
complex values, and that make check-octave-examples passes.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12671 626c5289-ae23-0410-ae9c-e8d60b6d4f22
It's currently not possible to tell SWIG whether or not symbols should be
loaded into the global namespace by default. In fact, it's not even possible
to make the generated .oct module *not* load all symbols globally, due to a
bug in Lib/octave/octruntime.swg (line 37: "noglobal" should be "global").
It's also not possible to change the name of the symbol used to access
global variables/constants from the default "cvar".
This patch adds 3 Octave-specific command-line options:
* -global/-noglobal tell SWIG whether the generated .oct module should load
symbols into the global namespace by default. The default option is -global
to preserve existing behaviour.
* -globals <name> sets the name of the symbol used to access global
variables/constants. It is set to "cvar" by default.
These options are parsed in Source/Modules/octave.cxx, and written to the
wrapping code as the macros SWIG_global_load and SWIG_global_name.
In Lib/octave/octruntime.swg, the Octave entry point DEFUN_DLD function now
contains a expanded input argument parser, which uses the same command-line
arguments (-global/-noglobal, -globals) as can be passed to SWIG itself;
this allows the module user to change the default loading behaviour of the
module user at load time. The parser checks for non-string and unrecognised
arguments, and also checks that the argument to -globals is a valid Octave
identifier. A -help option prints a short usage message.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12670 626c5289-ae23-0410-ae9c-e8d60b6d4f22