added ref/unref and friend dec. support comments
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5763 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
cf2e4870e7
commit
9497c8cb66
2 changed files with 138 additions and 0 deletions
137
CHANGES.current
137
CHANGES.current
|
|
@ -1,5 +1,142 @@
|
|||
Version 1.3.22 (in progress)
|
||||
==================================
|
||||
03/16/2004: mmatus
|
||||
Previously added, but not mentioned before:
|
||||
|
||||
- friend declaration support, swig now emits a global
|
||||
function in the same class scope.
|
||||
|
||||
- ref/unref features: to mix ref counting C++ classes
|
||||
and native script ref counting mechanism (like python).
|
||||
|
||||
Use it like:
|
||||
|
||||
%feature("ref") RCObj "$this->ref();"
|
||||
%feature("unref") RCObj "$this->unref();"
|
||||
|
||||
And the class RCObj, and all the derivated ones, will
|
||||
perform the rigth ref/unref calls when a new pointer
|
||||
is returned to the target language, or when the target
|
||||
language attemps to delete the object.
|
||||
|
||||
See the refcount.i file in the test-suite for more
|
||||
details.
|
||||
|
||||
|
||||
03/16/2004: mmatus
|
||||
[Python] Using the new %fragment support, major rewrote
|
||||
of the python swig library, including:
|
||||
|
||||
- Almost automatic template/typemap instantiation for
|
||||
the STL components. For example, now you can write:
|
||||
|
||||
%template(vector_i) std::vector<int>;
|
||||
|
||||
and a especialized vector_i class is emitted with all
|
||||
the needed typemaps. No need to use the old
|
||||
'specialize_vector' macros.
|
||||
|
||||
Note you can also define
|
||||
|
||||
%template(matrix_i) std::vector<std::vector<int> >;
|
||||
%template(vector_pii) std::vector<std::pair<int,int> >;
|
||||
|
||||
- The empty template instantiation
|
||||
|
||||
%template() std::vector<int>;
|
||||
|
||||
defines the vector typemaps, but no proxy class. For all the
|
||||
fundamental types, the empty template instantiation are
|
||||
defined, so, you can say
|
||||
|
||||
%include std_vector
|
||||
|
||||
int func(const std::vector<int>& a);
|
||||
|
||||
where the proper typemap is applied to 'a', but no
|
||||
std::vector<int> proxy is generated.
|
||||
|
||||
|
||||
- All the STL containers present a more uniform behaviour and
|
||||
more complete interface declaration. The following are
|
||||
now supported:
|
||||
|
||||
std::vector<T>
|
||||
std::list<T>
|
||||
std::deque<T>
|
||||
std::set<T>
|
||||
std::multiset<T>
|
||||
std::map<T>
|
||||
std::multimap<T>
|
||||
|
||||
not a container, but also supported:
|
||||
|
||||
std::pair<T,U>
|
||||
|
||||
also, more typemaps are defined for all of them,
|
||||
including varin, varout, typecheck, etc.
|
||||
|
||||
- Initial attemp to implement the STL containers
|
||||
considering allocators, ie:
|
||||
|
||||
std::vector<T,A>
|
||||
|
||||
it is partially working, but it is just a workaround
|
||||
while swig improves its template type support.
|
||||
|
||||
|
||||
Please test with your particular setup. It seems to be
|
||||
working with g++ 3.2.2, g++ 2.96, Intel icc and SGI CC
|
||||
compilers, plus python 1.5.2, 2.0 and 2.3, but since
|
||||
we are using templates, there is a chance you can find
|
||||
some problems when using with an old C++ compiler.
|
||||
|
||||
03/16/2004: mmatus
|
||||
|
||||
- Allowing the empty %template directive, such as
|
||||
|
||||
%template() std::vector<int>;
|
||||
|
||||
to process the class "typedef"s and "typemap"s. Before
|
||||
only the internal "typedef"s were processed.
|
||||
|
||||
This makes possible to emit the default in/out
|
||||
typemaps without the need of wrapping an especialized
|
||||
vector instance.
|
||||
|
||||
- Adding the preprocessor extension #@ which mangles the
|
||||
following macro argument, like in:
|
||||
|
||||
#define macro(X) #@X
|
||||
macro(int) -> int
|
||||
macro(std::string) -> std_s_s_string
|
||||
|
||||
- Fragments can now be "type especialized", as the typemaps. The
|
||||
syntax is as follows
|
||||
|
||||
%fragment("name","header")
|
||||
{ /* a type independent fragment (old syntax) */ }
|
||||
%fragment("name" {Type}, "header")
|
||||
{ /* the fragment is type dependent */}
|
||||
|
||||
Now fragments can also be used inside templates:
|
||||
|
||||
template <class T>
|
||||
struct A {
|
||||
%fragment("incode"{A<T>},"header") {
|
||||
/* 'incode' especialized fragment */
|
||||
}
|
||||
|
||||
%typemap(in,fragment="incode"{A<T>}) {
|
||||
/*
|
||||
here we use the 'type especialized'
|
||||
fragment "incode"{A<T>}
|
||||
*/
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
03/11/2004: cheetah (William Fulton)
|
||||
[Java] Director bug which meant that some virtual functions overridden in
|
||||
|
|
|
|||
1
README
1
README
|
|
@ -79,6 +79,7 @@ These improvements include:
|
|||
- Support for C++ overloaded operators.
|
||||
- Support for C++ templates including member templates.
|
||||
- Support for C++ template specialization and partial specialization.
|
||||
- Support for C++ friend declarations.
|
||||
- Parsing support for almost all C/C++ datatypes.
|
||||
- Automatic translation of C++ exception specifiers.
|
||||
- Contract support.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue