Commit graph

426 commits

Author SHA1 Message Date
Marcelo Matus
c827bad43b add argument protection for templates
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5778 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-03-20 00:23:40 +00:00
Marcelo Matus
95fa3be654 add 'attribute' macros for python
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5777 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-03-20 00:08:36 +00:00
Henning Thielemann
39d92e49b2 added basic Modula-3 support
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5776 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-03-19 11:45:29 +00:00
Marcelo Matus
cd59284111 missing change from previous commit
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5773 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-03-19 00:50:12 +00:00
Marcelo Matus
2568b57d46 extending std_string and more fixes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5771 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-03-18 21:20:55 +00:00
Marcelo Matus
8cc9533152 fix inclusion of complex.h
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5770 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-03-18 21:18:16 +00:00
Marcelo Matus
cf2e4870e7 another fix for long long
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5762 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-03-17 18:40:44 +00:00
Marcelo Matus
2537ee1c34 fix old std_pair version
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5760 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-03-17 10:45:19 +00:00
Marcelo Matus
1d5529bcfc better STL support, see CHANGES.current
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5755 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-03-17 09:41:19 +00:00
Marcelo Matus
958c18a14c Added more STL containers typecheck code.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5754 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-03-17 08:47:18 +00:00
Matthias Köppe
e3635aed11 In -scm mode, don't forget to check the type of string arguments.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5742 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-03-02 12:58:00 +00:00
William S Fulton
173a25a6fd New commandline option -namespace for putting all generated classes into a C# namespace.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5739 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-02-24 21:05:48 +00:00
Matthias Köppe
f7b0956236 Use FUNC_NAME rather than a bogus typemap variable for signalling
errors.  Call scheme_wrong_type with a zero-based argument number.
Reported by Ondrej Pacovsky, SF #902621.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5734 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-02-23 12:56:58 +00:00
Matthias Köppe
7fbaa3b633 Don't try to invoke a null destructor function.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5732 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-02-22 15:28:03 +00:00
Marcelo Matus
68024b15ce Reducing pyrun.swg and splitting python.swg into different files
for clarity and for easier maintainance.

pyrun.swg almost the same than 1.3.20, therefore there will be
compatible again.

code generated is reduced by the use and reuse of %fragments.

as usual, all the test-suite is compiling and a much bigger
"test project" too.

with the new typemaps definition should be much eaiser and
uniform add stl/std and user types.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5706 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-02-10 09:50:24 +00:00
Marcelo Matus
2a573e9a08 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/SWIG@5704 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-02-10 08:37:30 +00:00
Marcelo Matus
d3caa4eefc 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/SWIG@5703 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-02-10 03:42:38 +00:00
Logan Johnson
d562e7eef4 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/SWIG@5700 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-02-06 17:45:49 +00:00
Marcelo Matus
82d298ac31 add the CPLXFLT and CPLDBL checking codes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5692 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-28 01:34:32 +00:00
Marcelo Matus
3f1f31d1e8 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/SWIG@5691 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-28 01:30:13 +00:00
Marcelo Matus
c429cdb9fc 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/SWIG@5689 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-26 11:55:22 +00:00
Marcelo Matus
839f109a81 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/SWIG@5687 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-25 09:45:18 +00:00
Marcelo Matus
59e7aca99a 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/SWIG@5685 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-24 07:20:59 +00:00
Marcelo Matus
4b828ef358 fix missed ANY temporal
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5684 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-24 02:43:54 +00:00
Marcelo Matus
7c6097b392 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/SWIG@5683 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-24 00:43:47 +00:00
Marcelo Matus
5c62c8cda2 fix typos
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5676 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-23 00:25:42 +00:00
William S Fulton
0f9eff6b62 example correction
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5662 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-21 21:24:46 +00:00
Marcelo Matus
54737ee9a9 - 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/SWIG@5659 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-21 01:15:10 +00:00
Marcelo Matus
63cdb9b4d0 small error fixes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5649 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-20 20:51:46 +00:00
Marcelo Matus
9030e12d3f fix mixed type
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5647 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-20 20:46:31 +00:00
Marcelo Matus
63f7c13322 added 'self'
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5637 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-15 09:04:27 +00:00
Marcelo Matus
2f298a330a added the SWIG_CATCH_STDEXCEPT macro to map stdexcept -> SWIG_exception
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5628 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-13 01:41:19 +00:00
Marcelo Matus
e5ee4d1ac7 fixed the *::clone() warning
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5626 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-13 01:38:45 +00:00
Marcelo Matus
339a7e6aec restored the string kw, now it works fine
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5625 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-13 01:38:07 +00:00
Marcelo Matus
bcdcb96b47 Adding missing built-in functions and names to pythonkw.swg and
fixing operator! warning code in python.swg


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5573 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-12-16 06:00:09 +00:00
Dave Beazley
541803fdf9 *** empty log message ***
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5571 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-12-16 03:41:33 +00:00
Dave Beazley
686a6323c6 Changed warning to 321. 315 already used. Consult Warnings.html for list.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5570 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-12-16 03:40:00 +00:00
Dave Beazley
5f113875d1 Changed warning message.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5569 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-12-16 01:58:23 +00:00
Marcelo Matus
bc95409961 be sure the global bad names refer to global functions
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5567 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-12-15 19:29:09 +00:00
William S Fulton
574d1db50b Removed default %csmethodmodifiers
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5557 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-12-13 00:18:32 +00:00
William S Fulton
f75d7cd856 Removed default %javamethodmodifiers
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5556 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-12-13 00:17:58 +00:00
Dave Beazley
9494cfbf85 *** empty log message ***
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5551 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-12-12 18:29:00 +00:00
Marcelo Matus
a8e552c932 added defined
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5550 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-12-12 08:25:10 +00:00
Marcelo Matus
720993e41f using code 315 for bad names only
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5548 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-12-12 07:15:00 +00:00
Marcelo Matus
c32f1d93d1 added ocaml keywords
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5547 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-12-12 07:12:42 +00:00
Marcelo Matus
8e8e0ce6e8 Forgot #undefs, add python bad names, change names from
tclkw.swg and phpkw.swg to the right ones tcl8kw.swg and php8kw.swg.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5546 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-12-12 06:15:46 +00:00
Marcelo Matus
8abe741cdc swig -DSWIG_ALLKW was too ugly. Use -Wallkw instead. Reverting swig.swg
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5545 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-12-12 06:12:29 +00:00
Marcelo Matus
7b8f415319 - Uniform the definition of the keyword warnings through
the supported languages.

- Added keyword list for most of the languages that didn't
  have one.

- "All keywords" warning support, through the -DSWIG_ALLKW
  option.

Read the Changes.current


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5543 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-12-12 02:23:52 +00:00
Marcelo Matus
72984676ca Lateral change to add runtime "reprotection" at the python
side for protected director members.

Lib/python/director.swg: added needed code for runtime checking
Source/Modules/python.cxx: added needed code for runtime checking
director_protected_runme.py: checks now that the runtime protection is working


The extra runtime checking is only done for protected members,
so, the old public directors members don't feel any overhead.

This finished the director protected support for the python language.
Java and Ocalm will need to add the "reprotection" mechanism latter.
But as in the python case, the changes will be localized in the
languages files, and there will be no need to touch the core
files anymore.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5532 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-12-11 01:59:12 +00:00
William S Fulton
f2625b4671 Corrected SWIG_JavaThrowException to be static
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5521 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-12-09 21:54:59 +00:00