Commit graph

80 commits

Author SHA1 Message Date
Marcelo Matus
e2f5c7674c solve using+namespaces (using_namespace.i) and nested+derived classes (derived_nested.i)
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6506 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-10-26 00:21:40 +00:00
Marcelo Matus
5023285fb8 Fix directors + protected pure virtual members + protected
constructor.

Now it doesn't crash, you don't need to use dirprot, and no, it is not
emitting all the protected members, unless dirprot is used.

Swig only emits the protected members or constructors needed to prevent
the compilation for crashing. The rest of the protected members
are emitted when dirprot is used.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6493 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-10-24 05:58:15 +00:00
Marcelo Matus
099dfdbefe fix wrong warning from keyword + friend
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6490 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-10-24 05:45:23 +00:00
William S Fulton
74f9ab820b compact default arguments feature (original default argument wrapping mode)
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6449 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-10-20 20:59:33 +00:00
William S Fulton
a889c59f3b - compact default arguments feature (original default argument wrapping mode)
- fix for templated functions in a namespace


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6448 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-10-20 20:49:49 +00:00
Marcelo Matus
ced0d5e023 fix for template+default template params, better warnings, better management of extern "java"
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6424 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-10-18 01:23:20 +00:00
William S Fulton
13926748ee templated function overloading support
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6394 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-10-16 20:41:17 +00:00
Marcelo Matus
2459ec99d1 add initial C99 complex support + long double
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6384 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-10-10 08:18:14 +00:00
Marcelo Matus
ed25a4df08 fix extend_placement.i case, ie extend overloding + member overloading
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6334 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-10-05 23:17:40 +00:00
William S Fulton
06989d7a7b revoke previous %extend+overload fix.
It might need to come back to fix templates. Not sure yet.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6328 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-10-05 22:15:45 +00:00
Marcelo Matus
398b4d6f77 add support for empty throw(), needed by director
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6319 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-10-05 20:57:08 +00:00
Marcelo Matus
776f15623e several fixes, see CHANGES.current 10/04/2004
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6317 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-10-05 00:19:26 +00:00
William S Fulton
fa2a384f71 New default argument wrapping approach. This adds default argument support for statically typed languages, fixes wrapping of default arguments that are non-public plus fixes other bugs where SWIG could not or failed to correctly lookup up the default value in the symbol table.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6305 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-10-04 20:19:31 +00:00
Marcelo Matus
2e9ef019df fix %extend+overload error
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6298 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-10-04 03:18:57 +00:00
Marcelo Matus
0bcc1a43ae fix bitfield with expr
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6286 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-10-02 02:11:40 +00:00
William S Fulton
4c02e7cc0e Fix for enum forward declarations
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6117 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-08-23 20:10:51 +00:00
William S Fulton
eafe8d5abf missing ;
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6034 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-07-12 19:46:10 +00:00
William S Fulton
e2454484ba 1)
%feature improvements for the syntax that takes the feature value within the
            %feature() brackets. The value specified is no longer restricted to being just
            a string. It can be a string or a number. For example, this is now acceptable
            syntax:
              %feature("featurename",20.0);
            whereas previously it would have to have been:
              %feature("featurename","20.0");
            Useful for features that are implemented as a macro, for example:
              #define %somefeature(value)      %feature("somefeature",value)
            These will now work accepting either a string or a number:
              %somefeature("Fred");
              %somefeature(4);

2)
            %feature enhancements. Features can now take an unlimited number of attributes
            in addition to the feature name and feature value. The attributes are optional
            and are much the same as the typemap attributes. For example, the following
            specifies two optional attributes, attrib1 and attrib2:

             %feature(featurename, attrib1="attribval1", attrib2="attribval2") name "val";
             %feature(featurename, val, attrib1="attribval1", attrib2="attribval2") name;


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5997 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-06-27 20:48:57 +00:00
William S Fulton
f2100be746 Unnamed enum instance in global scope fix
enumvalueex attribute now set during the type pass


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5922 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-05-24 20:13:55 +00:00
William S Fulton
d80d8dba3b Fix for unnamed enum member variables
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5882 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-04-22 20:36:13 +00:00
Marcelo Matus
aa33886558 error fix in lang.cxx and more comments
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5871 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-04-11 08:09:57 +00:00
Marcelo Matus
405a7335a7 fix java reg. tests and add -directors flag
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5867 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-04-11 05:55:35 +00:00
William S Fulton
9e495501fd mods for adding enums to the symbol table
enumvalue split into enumvalue and enumvalueex


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5847 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-04-09 19:28:16 +00:00
Marcelo Matus
6184dceb5b Fragments can now be "type especialized", as the typemaps. The
syntax is as follows

 %fragment("name","header") { /* an old fragment */ }
 %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> }
      */
   }
 };

Also, there is a minor templ.c fix when expanding '#T'.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5749 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-03-17 08:01:06 +00:00
William S Fulton
6516029372 Fixes for compilation by the Digital Mars Compiler. Submitted by Scott Michel.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5728 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-02-20 22:51:47 +00:00
Marcelo Matus
6dceec6fdb 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/SWIG@5690 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-27 23:39:35 +00:00
Marcelo Matus
4e7f391eba 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/SWIG@5679 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-23 23:26:46 +00:00
William S Fulton
b0df32dd1a Various warning fixes for .NET 2003 cl /W4 to work barring one warning and for gcc -ansi -Wall -pedantic to be warning free:
const fixes and function prototype declarations matching the definition etc


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5639 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-15 22:46:07 +00:00
Marcelo Matus
8d9bdc8148 minor cosmetic fixes in the 'error' attribute
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5636 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-15 09:02:41 +00:00
Marcelo Matus
bd9aa0c7c9 - Normalize the 'Swig_error' calls and formats, before some
of the strings start like "Error. XXX", others like "XXX".
  The format is now defined in 'error.c:Swig_error_msg_format()'.

- Normalize the multiline error/warning messages to correctly
  use -Fformat definition.

- Centralize the error/warning format definitions in
  'error.c:Swig_error_msg_format()'.

- Fix a minor error in cpp.c, that after finding an error, still
  was emitting a redefined macro, producing duplicated error/warning
  messages in parser.y.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5635 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-15 08:33:12 +00:00
Marcelo Matus
74d6f1eb43 Added the warning code
WARN_PARSE_REDUNDANT          322

similar to the g++ -Wredundant-decls flag.

This recovers the warnings that now are not been reported by
the original code

   WARN_PARSE_REDEFINED          302

Redundant example:

   int foo(int);
   int foo(int);

Redefined example:

   int foo(int);
   double foo(int);


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5634 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-15 08:16:53 +00:00
Marcelo Matus
eaa0062cd2 Fix for friend declarations, and other 'repeated' declarations.
Now, this doesn't generate warnings:

 class A; class B*;

 int foo(A*, B*);

 struct A {
   friend int foo(A*, B*);
 };

but this generates

 struct B {
   friend double foo(A*, B*);
 };

which is correct, since they have different return types.

See the redefined.i file for most cases where
repeated (but not redefined) declarations are
not generating warnings now, such as:

// no warning
#define REPEATED 1
#define REPEATED 1

// yes warning
#define REDEFINED 1
#define REDEFINED 2

this is following the C, C++ and preprocessor
standard behavior.

The function 'need_redefined_warn(..)' was added to
util.c, if some strange corner appears, and therefore,
the parser.y file doesn't need to be changed latter.

Also, the redefined warning format in parser.y
was changed, so now it respond to William's -Fmicrosoft
flag.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5633 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-15 03:16:40 +00:00
Marcelo Matus
6d1978b1ef added friend support and reduced spurious name(kw) warnings for non-wrapped symbols
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5624 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-13 01:32:13 +00:00
Marcelo Matus
89b8bdc89e fixed dirprot member detection and add code to detect when a node need to checked for kw warnings
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5620 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-01-13 00:52:25 +00:00
William S Fulton
c00aaf0f5b Moved non static function declarations from source files into header files
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5602 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-12-28 21:48:39 +00:00
William S Fulton
379bff84e4 Moved non static function declarations from source files into header files
Added header include guard


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5601 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-12-28 21:44:41 +00:00
Marcelo Matus
9c372c5c64 Fixed more %rename errors, and moving
the function 'need_protected' outside parser.y,
ie, if more subtle cases appear, they can be
fixed without changing parser.y.

Now parser.y looks much more like the original 1.32.

 Source/CParse/parser.y: moving and fixing 'need_protected'
 Source/CParse/util.c:  moving and fixing 'need_protected'
 Examples/test-suite/director_protected.i: more %rename cases
 Examples/test-suite/director_using.i: fixing bad module name

The errors in question where related to the mix of
%rename + (typedef|static)  + protected + dirprot_mode:


%rename(s) Foo::p;
%rename(q) Foo::r;

%inline {
class Foo {
public:
  virtual ~Foo() {}

  int p(){ return 1;}
  int r(){ return 1;}

protected:

  typedef int q();
  static int s();
};

since q and s look like functions, the parser was adding them
completly to the symbol table, and clashing latter with the
attemped renames.

The error was only visible when dirprot was enabled, with
the old behavior it was ok.

Marcelo


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5533 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-12-11 03:59:18 +00:00
Marcelo Matus
c41374becc %rename(x) Foo::y();
%inline %{
class Foo {
protected:
    void x();
public:
    void y();
};

%}

will work in plain or plain director mode, but it will complain the
same as before with director protected support.

The reason is that the parser emmits the warning, and at that stage it
is not possible to decide if the protected Foo::x() could or not
conflict with the renamed Foo::y(), since Foo::x() could be virtual,
even when no "virtual" attribute is used.



Core:
 parser.y: Detect the dirprot mode and prevents the generation of
           protected symbols at the parsing stage.
 lang.cxx: Export the director_protected_mode for parser.y and the
           director protected member detection is much cleaner.
 main.cxx: Fix the -dirprot flag, it was working in SWIG_FEATURE but
           not in the command line.(minor thing not relate to the error).
 swigmod.h: added Lang::dirprot_mode() for cleaner detection.
 utils.cxx: is_member_director() centralizes and improve the test.

Test suite:
 protected_rename.i: added %inline, so it can compile now.
 director_protected.i: more cases, checking using %rename.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5530 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-12-10 23:10:31 +00:00
William S Fulton
d95a07f486 Warning fix for Visual C++. const is incorrectly being defined away to nothing.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5495 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-12-07 00:29:00 +00:00
Marcelo Matus
ad8819f01e Check the protected constructor case. They don't get into the director.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5486 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-12-05 06:08:54 +00:00
Marcelo Matus
0f19564193 Fixes to support protected members with director, proper virtual member recognition and support of the nodirector feature
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5485 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-12-05 01:59:28 +00:00
Dave Beazley
d61738778a Fixed parsing problem with = &x[]. This was causing the
Java java-lib_various.i test to fail.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5419 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-11-26 19:54:09 +00:00
Dave Beazley
9a0a04303d [ 756552 ] missing default argument class scope with "|"
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5403 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-11-25 19:27:17 +00:00
Dave Beazley
075af8535a [ 840878 ] support for %inline { ... } (PATCH)
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5401 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-11-25 18:48:11 +00:00
Dave Beazley
e7c45edd39 Fixed [ 836903 ] C++ inconsistency (with void arguments).
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5398 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-11-25 18:26:03 +00:00
Dave Beazley
ed4fd6b6cd Fixed [ 791835 ] Default argument with cast: txt = (char *)"txt" syntax Error.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5392 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-11-25 16:48:51 +00:00
Dave Beazley
603a9e5076 Added error message for using %template with qualified names inside of
a namespace.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5174 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-09-30 18:57:45 +00:00
Dave Beazley
8ae4c60d39 Major refactoring of DOH List/Hash iterators. See CHANGES
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5101 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-09-11 20:26:57 +00:00
Dave Beazley
a969cc81d3 Fixed [ 794914 ] Wrong types in template specialization.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5060 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-09-01 19:59:39 +00:00
Dave Beazley
aa9c5cc68e Fixed [ 797573 ] no way to rename classes coming from C structures.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5051 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2003-09-01 17:54:22 +00:00