Commit graph

4,854 commits

Author SHA1 Message Date
Marcelo Matus
15923cd8b8 Added the ref/unref 'recursive' featues. See refcount.i for details
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5705 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-02-10 09:21:36 +00:00
Marcelo Matus
d29dbe752d Keep the old non-resolved type str and add the fully
resolved one if is needed.

Add examples showing the problem with SWIG_TypeQuery
and template+typedef and the old type str, and how
it works now.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5704 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-02-10 08:37:30 +00:00
Marcelo Matus
9f9e05ad30 Fixes for SWIG_TypeQuery and templates/typedefs,
before the swig_type_info fields 'str' and 'name'
where not consistent, one was fully resolved (name),
the other not, therefore

  typedef int Int;
  template <class C> struct Class {};

  SWIG_TypeQuery($descriptor(Class<int>*))

wasn't necessary the same that

  typedef int Int;
  template <class C> struct Class {};

  SWIG_TypeQuery("Class<int> *")

the problem was visible only when the latter form was used,
like in a static auxiliar function outside a typemap.

also, relax type name comparison with blanks, ie

  SWIG_TypeQuery("Class<int> *") := SWIG_TypeQuery("Class<int > *")


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5703 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-02-10 03:42:38 +00:00
Logan Johnson
c28431b42b Omit unused parameter names for C++ code only; this is illegal in C.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5702 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-02-09 23:08:54 +00:00
Logan Johnson
d43a3d22e4 Be sure to initialize all of the fields of a PyMethodDef struct to some
value, to avoid numerous compiler warnings.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5701 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-02-06 17:46:50 +00:00
Logan Johnson
5c2a00ba85 Be sure to initialize all of the fields of the PyTypeObject struct to
something, to avoid numerous compiler warnings.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5700 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-02-06 17:45:49 +00:00
Logan Johnson
48cd3f8afc Make sure that all fields of the swig_type_info struct are initialized
to something, to avoid numerous compiler warnings.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5699 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-02-06 17:44:13 +00:00
William S Fulton
c523afc3ec New test case testing some broken aspects of %feature
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5698 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-02-04 21:05:39 +00:00
William S Fulton
11ed0bc80b fix classLookup() to return consistent results when %ignore specified
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5697 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-02-03 21:19:19 +00:00
Marcelo Matus
e4025170df added another simple method
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5696 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-02-02 21:11:28 +00:00
Matthias Köppe
6cf25c39da Fix typos in help text.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5695 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-02-01 12:01:49 +00:00
Marcelo Matus
2f9749cb04 cosmetic fix to avoid warnings in the generated code
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5694 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-28 01:47:19 +00:00
Marcelo Matus
cff86e376c add complex test
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5693 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-28 01:38:59 +00:00
Marcelo Matus
ee9e4bce5e add the CPLXFLT and CPLDBL checking codes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5692 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-28 01:34:32 +00:00
Marcelo Matus
b85c9ace6b Fix long long and other warnings.
Add the macros

%typemap_asfromcheck()
%typemap_asfrom()

that can be used to defined all the different typemaps
for types where the As/From/Check methods are provided.

All the basic type (int, char,...) typemaps are implemented
using them.

The std::string and std::complex<T> are reimplemented using
the new %typemap_asfrom/check macros too. This helps to complete
all the previously missing typemaps (consttab, varin, varout,..)
and also ilustrates how to define the As/From/Check methods
to use with the %typemap_asfrom/check macros.

As a byproduct, the C complex typemap was added, and the file

complex.i

can be used to load the complex support for either C or C++. The
original C++ std_complex.i is still there, and the corresponding C
ccomplex.i too, if they need to be included explicitly.

Also, the As/From methods are declared via %fragment, so, they
can be reused as needed, and only appear in the wrapped code if
they corresponding typemap is invoked, making the typemaps
and the entire code shorter and simpler.


Marcelo.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5691 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-28 01:30:13 +00:00
Marcelo Matus
9b4df57aa4 Simple patch to allow fragments to include other fragments:
%fragment("Hello","header") "..."

%fragment("Hi","header",fragment="Hello") "..."

the latter fragment will include the first one if is invoked.

more than one fragment can be included at the time, just
keep adding fragment="f1",fragment="f2", etc.

this is used to emulate typemaps reuse, where all the
reusable typemap code is put in a fragment static method,
and then it can be included from another fragment typemap
as needed.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5690 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-27 23:39:35 +00:00
Marcelo Matus
aabed0eedf add support for char* to accepts char* :), before
they only accept PyStrings.

now the raw pointer from calloc.i, for example, works
fine.

some of the SWIG_PyObj_(As|From)XXX routines are getting
too large, so, they also will go into the runtime library.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5689 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-26 11:55:22 +00:00
Marcelo Matus
8a9803addf fix memory leak with director and NewPointerObjects
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5688 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-26 10:20:06 +00:00
Marcelo Matus
dc061e30f1 Better mapping of char[ANY] in python, including embedded
null chars, which are allowed in C++ and python, and proper
sizes:

  you can use a shorter string to assign a char[6]:

     x = "he\0l"  -> x := {'h','e',0,'l',0, 0}

  but you always get back in python the original size:

   x := {'h','i','0','0',0, 0} -> "hi\0\0\0\0"

Better mapping of (char*)0, now you get a None in the python
side, and using None, you get a (char*)0, just like
all the other C++ pointers. Before (char*)0 was mapped
into python as "", or as seg. faults.

Better mapping of "", which is not None nor (char*)0.

Added more tests using primitive types with simple templates.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5687 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-25 09:45:18 +00:00
Marcelo Matus
f2995151b1 fix expansion for templates, ie from Type<(int)> to Type<int>
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5686 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-25 09:22:35 +00:00
Marcelo Matus
b3896b1919 properly manage the strange but valid case:
typedef char namet[5];
  const namet def_namet = {'h','o', 0, 'l','a'};

ie, char arrays with null embedded characters, and other odd
char[ANY] situations.

add the corresponding test to the primitive_types.i and runme files.

Marcelo

 ----------------------------------------------------------------------


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5685 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-24 07:20:59 +00:00
Marcelo Matus
e4450c9ba7 fix missed ANY temporal
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5684 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-24 02:43:54 +00:00
Marcelo Matus
4ea03cbb10 more on uniforming and 'securing' the typemap declarations
for primitive types.

Finally, you can safetly write:

%apply int {enum Hello};
%apply long {size_t};
%apply int {MyIntClass};

or using references

%apply const int& {const enum Hello&};
%apply const long& {const size_t&};
%apply const int& {MyIntClass&};

and all the primitive typemaps(in, out, directorin, directorout,
constcode, throws, varin, varout) are safetly applied to the
desired types (including the proper conversions when needed).

In fact, the python.swg file now has no typemap
defined for enums, and only use the %apply directives
as above.

Now the primitive_types.i extensive test runs properly.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5683 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-24 00:43:47 +00:00
Marcelo Matus
2625795a82 add support for 'throw' declarations in director classes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5682 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-24 00:28:54 +00:00
Marcelo Matus
94405ed6eb add support for 'throw' declarations in director classes and some fixes to compile the primitive_types.i test file
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5681 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-24 00:25:31 +00:00
Marcelo Matus
9d10f61cbd add extensive tests for the primitive types, it will crash in almost every language now, see the file for instructions about some typemaps that need to be fixed
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5680 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-24 00:21:02 +00:00
Marcelo Matus
330628162e saves the rawval constant attribute when presents. this simplifies the generation of typemaps for char/strings
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5679 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-23 23:26:46 +00:00
Matthias Köppe
9c5c689760 *** empty log message ***
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5678 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-23 15:08:33 +00:00
Matthias Köppe
13aa3aa794 Uniquify the argument names used in GOOPS method declarations.
Reported by rm@mh-freiburg.de.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5677 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-23 15:05:34 +00:00
Marcelo Matus
f981296961 fix typos
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5676 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-23 00:25:42 +00:00
William S Fulton
deee48b017 Fixes to link on Cygwin
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5675 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-22 22:43:32 +00:00
William S Fulton
238e948bbe Eric Sunshine patch - Mods to work on NextStep
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5674 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-22 22:42:18 +00:00
William S Fulton
0d99906f68 Eric Sunshine patch
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5673 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-22 22:39:17 +00:00
William S Fulton
1869f2d821 Eric Sunshine patch - build fixes for NextStep. Fixes for Ruby 1.8.x.
Slightly modified Ruby patch so it works on Cygwin.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5672 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-22 22:39:08 +00:00
William S Fulton
308b68f137 Eric Sunshine patch - note about gmake having to be used to build swig
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5671 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-22 22:37:15 +00:00
Marcelo Matus
4a50816ddb simple in fix the %new cleanup and the destructor handler
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5670 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-22 08:00:49 +00:00
Marcelo Matus
d02ce4b533 sorry, last commit was from an older version
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5669 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-22 07:17:05 +00:00
Marcelo Matus
4e40e430cf more comments and cases in the unrollVirtual method, still there is one that is not working...
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5668 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-22 07:07:41 +00:00
Marcelo Matus
55e0ea52bd added refcount example using the old macro way and the proposed ref/unref features
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5667 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-22 06:26:17 +00:00
Marcelo Matus
baf05fd515 added test for simple virtual derivation, where ruby fails
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5666 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-22 06:23:57 +00:00
Marcelo Matus
e63a259672 also, change the module name to director_frob
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5665 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-22 00:52:06 +00:00
Marcelo Matus
f7a318c637 using better names for frob
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5664 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-22 00:41:37 +00:00
William S Fulton
643da18a02 forte warning fixes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5663 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-21 21:27:43 +00:00
William S Fulton
208386909b example correction
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5662 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-21 21:24:46 +00:00
William S Fulton
62c17bc996 Improved runtime tests
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5661 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-21 21:23:31 +00:00
Marcelo Matus
91ea054303 fix the generation of spurious temps, and an exception call
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5660 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-21 01:33:07 +00:00
Marcelo Matus
dedb5a9697 - recover the proper catching exception mechanism for classes
(throw typemap).

- fix the examples with exception problems and warnings

- proper and consist treatment of basic types (short, unsigned char,...)

  now all are checked for range and sign. Before, this was depending of
  the use of parsing or no parsing, and/or the converter method, and/or
  the use of directors, etc.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5659 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-21 01:15:10 +00:00
Marcelo Matus
7b6925d8ca better treatment of the '0' director methods case
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5658 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-21 01:04:50 +00:00
Marcelo Matus
6b0485b6b5 fixes for the nodirector feature and the '0' director member case
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5657 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-21 00:46:08 +00:00
William S Fulton
01a1e83dcb Memory management fixes and comment corrections
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5656 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-20 21:28:29 +00:00