Commit graph

43 commits

Author SHA1 Message Date
Olly Betts
631b41ae7b Use https for swig.org links 2022-10-06 13:16:39 +13:00
Olly Betts
892557e799 Improve #include guard macros
Avoid using reserved identifiers such as `_DOHINT_H` (fixes #1989),
fix cases where the name doesn't match the filename, and make the naming
more consistent and less likely to collide with include guards in other
headers.
2022-07-19 09:35:46 +12:00
Olly Betts
6c4010e442 Resolve -Wstrict-prototypes warnings with clang-15
warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
2022-06-30 12:52:00 +12:00
William S Fulton
9deaa6ff24 new_node refactor
Reduce code duplication for doxygen to match code in master prior to
merge to master
2018-05-19 09:00:06 +01:00
Vadim Zeitlin
e668c47b70 Merge branch 'master' into doxygen
The way Python docstrings are indented has changed on master, so use the
standard inspect module in Python autodoc unit test to ignore the differences
in their indentation level between -builtin and non-builtin cases to make the
test still pass with the branch version, which avoids the use of different
(but almost identical) values in the test itself.
2016-12-12 01:24:17 +01:00
Jiulong Wang
e1afb6fdbe Fix enum error when value contains char in compound expression
Problem: When enum value contains compound expression with a char
constant, the quotes around char constant is missing in the generated
expression. Example:

enum media_type {
  YUY2 = ((('2' << 24) | ('Y' << 16)) | ('U' << 8)) | 'Y'
};

The generated C# enum becomes:

public enum media_type {
  YUY2 = (((2 << 24)|(Y << 16))|(U << 8))|Y
}

While the correct representation (after this fix) should be:

public enum media_type {
  YUY2 = ((('2' << 24)|('Y' << 16))|('U' << 8))|'Y'
}

Causes: the exprcompound promotes the expression type from char to int
and uses $1.val in the generated expression. However $1.val does not
contain the quotes. Since the type is promoted to int, there's no way to
know there's char component in the compound expression.

Solution: in exprcomound, use $1.rawval if $1.type is T_CHAR or T_WCHAR.
The rawval contains quotes which yield correct expression.
2016-09-07 15:46:16 -07:00
William S Fulton
faeaacf112 smartptr feature support - factor out common code 2015-09-25 22:57:59 +01:00
Vadim Zeitlin
300ccce46c Another merge with master.
Change Doxygen error codes to start at 740 instead of at 720 as the latter was
taken by Scilab in the meanwhile.

Resolve conflicts in autodoc_runme.py once again.
2015-02-16 23:46:39 +01:00
Olly Betts
04715f74e2 Improve error message when an unknown SWIG directive is used
This previously gave the cryptic "Error: Syntax error in input(1).", but
now gives "Error: Unknown directive '%foo'."
2015-01-08 12:07:54 +13:00
Vadim Zeitlin
6cce652762 Merge latest master into doxygen branch again.
Update Doxygen-specific Python unit tests to work with the new indentation.

Update one of Doxygen-specific Java tests to still build with the new handling
of srcdir.
2014-08-13 16:11:21 +02:00
William S Fulton
71e72c45ed Create separate extetnd.c file for handling extensions / %extend
This is just a simple code refactor, moving and function renaming to
remove the %extend code out of the parser into its own file now
 that it isn't just used in the parser.
2014-05-21 19:16:15 +01:00
Vadim Zeitlin
1ebd2334b8 Merge branch 'master' into doxygen
Merge with ~3.0.1 sources from master.
2014-04-30 18:37:57 +02:00
William S Fulton
2121e1217e Ensure -c++out is not used with -c++
Error checking for this combination implemented as well as correcting
Octave

Also refactor, replacing CPlusPlusOut variable with cparse_cplusplusout
for an implementation which more closely resembles cparse_cplusplus which
is also required in both .c and .cxx files.
2013-12-12 20:52:44 +00:00
Vladimir Kalinin
b63c4839fe Nested classes support
Closes #89
Squash merge branch 'master' of https://github.com/wkalinin/swig into wkalinin-nested

By Vladimir Kalinin
* 'master' of https://github.com/wkalinin/swig:
  CPlusPlusOut mode for Octave
  nested class illustration
  fixed "Abstract" flag for nested classes added an example enabled anonymous nested structs runtime test
  porting
  warnings disabled
  porting fixes
  java runtime tests ported
  nested class closing bracket offset fixed
  removed double nested template (not supported by %template parsing)
  template_nested test extended
  parent field made public
  property access fixed
  replaced tabs with spaces
  warning W-reorder
  deprecated warnings removed, derived_nested runtime test added
  optimized string indenting
  Nested classes indenting
  nested classes docs
  fixed the order in which flattened inner classes are added after the outer
  Private nested classes were getting into the type table.
  Java getProxyName() fix for nested classes fixes the case when nested classes is forward declared
  Fix for a case when a nested class inherits from the same base as the outer. (Base class constructor declaration is found first in this case)
  merge fix
  nested C struct first immediate declaration incorrectly renamed sample fixed
  tests updated to reflect nested classes support
  Java nested classes support (1)
  flattening should remove the link to the outer class
  access mode correctly set/restored for nested classes
  nested templates should be skipped while flattening (template nodes themselves, not expanded versions) also non-public nested classes should be ignored
  If nested classes are not supported, default behaviour is flattening, not ignoring flag "nested" is preserved, so, the nested classes can be ignored by user
  nested workaround test updated
  template instantiated within a class is marked as nested for ignoring purposes
  %ignore not applied to the nested classed, because "nested" flag is set too late
  typedef name takes precedence over the real name (reason?)
  unnamed structs should be processed for all the languages
  nested C struct instances are wrapped as "immutable"
  tree building
  typedef declaration for unnamed C structures fixed
  nested classes "flattening"
  fixed %ignoring nested classes
  renamed "nested" attribute to "nested:outer" added "nested" flag, to be used with $ignore (it is not removed while flattening) added nestedClassesSupported() function to the Language interface
  renamed "nested" attribute to "nested:outer" added "nested" flag, to be used with $ignore (it is not removed while flattening) added nestedClassesSupported() function to the Language interface
  tree iteration fix
  dirclassname variable names unified memory issue fixed
  merge error
  ignore unnamed structs for C++
  unnamed nested C structs naming & unnesting
  class added to classes hash under typedef name
  private nested classes skipped
  test updated due to nested templates support
  anonymous structs with inheritance fixed nested_class test to allow anonymous structs w/o declarator
  tests updated: nested workaround removed from namespace_class.i propagated nested template declaration to the C++ file
  injected members scope
  nested tempplates fixes, nested structures in "C" mode parsing added utility function "appendSibling" (like "appendChild")
  nested unnamed structures parsing fixes, access mode restored on nested class end, tdname is properly patched with outer class name prefix
  memory management fixes
  nested templates (1)
  Nested unnamed structs
  Nested class support (1)
  Nested class support (1)
2013-11-29 07:02:34 +00:00
Dmitry Kabak
b0f8e594c9 Implement toggling comment parsing feature on and off
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-doxygen@13182 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2012-06-18 18:30:18 +00:00
William S Fulton
931628f8b2 Remove the svn/cvs Id string in the headers
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11877 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-02-28 00:09:20 +00:00
William S Fulton
cb64f65bae SWIG license change - Source moves to GPLv3
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11876 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-02-27 23:53:33 +00:00
William S Fulton
83bd820285 Add typemaps used debugging option (-debug-tmused). Fix missing file/line numbers for typemap warnings and in the output from the -debug-tmsearch/-debug-tmused options
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11802 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2010-01-04 19:33:52 +00:00
Haoyu Bai
47b4825168 Merged revisions 11085-11086,11088-11089 via svnmerge from
https://swig.svn.sourceforge.net/svnroot/swig/branches/swig-2.0

........
  r11085 | bhy | 2009-01-25 00:21:55 +0800 (Sun, 25 Jan 2009) | 2 lines
  
  Fix const-correctness.
........
  r11086 | bhy | 2009-01-25 02:08:50 +0800 (Sun, 25 Jan 2009) | 2 lines
  
  Correct some function definition in header files, which implementation changed in previous commit caused mismatch.
........
  r11088 | bhy | 2009-01-25 02:38:32 +0800 (Sun, 25 Jan 2009) | 1 line
  
  minor fix and now SWIG is alive again
........
  r11089 | bhy | 2009-01-25 06:07:07 +0800 (Sun, 25 Jan 2009) | 1 line
  
  Correct some bug introduced in previous commits. Now SWIG is pretty good with C++ compiler.
........


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11097 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-01-30 10:27:37 +00:00
Haoyu Bai
6d2aef67d9 Replaced all [const] String_or_char * to const_String_or_char_ptr, by the following command:
sed -i "s/\(const \)\?String_or_char \*/const_String_or_char_ptr /g" CParse/* Include/* Modules/* Preprocessor/* Swig/*

This is a preparation for moving to new DOH, since for strong typed objects we need the const_String_or_char_ptr class to implicit convert to and from String * or const char *.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11080 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2009-01-24 13:15:51 +00:00
William S Fulton
8ac9453f62 Fix -nopreprocess option to correctly generate output filenames and display filenames in warnings and errors
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10930 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-11-16 21:40:28 +00:00
William S Fulton
61001d958f add parameter list (or void) to all C functions
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10926 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2008-11-11 22:17:40 +00:00
Dave Beazley
b92d8e5cff Major overhaul of C/C++ scanner API. Unified tokenizing code so that tokens are scanned by a common code base
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9639 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-01-12 19:01:40 +00:00
Dave Beazley
8a9b2cbdb1 Changed Header to Id
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9610 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-12-05 22:14:31 +00:00
William S Fulton
aa04c4c057 beautify/format source code with gnu indent
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9505 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-11-01 23:54:54 +00:00
William S Fulton
7f74b8e7a3 Common template for head of each file detailing licence, distribution and authors information
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8972 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-03-06 22:51:01 +00:00
Marcelo Matus
b044703d0d better support for the %throws directive
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8350 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-01-10 17:19:22 +00:00
Marcelo Matus
55005e98ee Move rename/namewarn engine from parser.y to naming.c. The code was getting
too large to be in the parser.

Centralize the swig keys to avoid replication and wrong spellings.

Use more HashGetAttr where possible and other speed improvements
to compensate for the extra work introduced by the new rename/namewarn
mechanism.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8170 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-01-02 04:33:19 +00:00
Marcelo Matus
b034e6c266 add support for options in rename/namewarn and central methods to access the rename/warning hashs
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8150 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-12-31 10:41:54 +00:00
Marcelo Matus
381596b0f3 add the copyctor feature/directive to enable automatic copy constructors. In the way, fix how default ctor/dtor are added
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8129 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-12-30 00:04:00 +00:00
Marcelo Matus
7a4a6c5d04 add notemplatereduce
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7936 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-12-07 07:14:14 +00:00
Marcelo Matus
a4c0114c6a replace bad parameter names when neccessary
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7699 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-10-21 10:43:41 +00:00
Marcelo Matus
0ac8253c3f fixes for templates and template default args, cosmetics, and other fixes for OSS
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6893 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-12-16 02:12:05 +00:00
Marcelo Matus
9b963f9763 support of typemaps + template + template def args
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6808 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-12-01 01:01:03 +00:00
Marcelo Matus
3fc7b773d9 fixes for namespaces + class declarations + %template directive
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6576 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-11-01 08:38:21 +00:00
Marcelo Matus
f15126aee3 add templatereduce option
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6543 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-10-28 23:49:41 +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
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
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
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
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
William S Fulton
4916ec684c swigver.h removed
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4183 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2002-12-11 22:30:54 +00:00
Dave Beazley
12a43edc2d The great merge
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4141 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2002-11-30 22:01:28 +00:00