SWIG (Simplified Wrapper and Interface Generator) See the CHANGES.current file for changes in the current version. See the RELEASENOTES file for a summary of changes in each release. Version 3.0.10 (12 Jun 2016) ============================ 2016-06-06: mromberg [Python] Patch #698. Add support for -relativeimport for python 2.7, so -py3 is no longer also required for relative import support. 2016-06-05: mromberg [Python] Patch #694 - Fix package import regressions introduced in swig-3.0.9. 1) The code in 3.0.9 did not fall back to 'import _foo' if 'import bar._foo' failed (assuming bar.foo was the main module). Every place _foo is imported now first tries it from the package where foo was found and if that fails tries _foo as a global module. 2) The separate block of Python code that injected code to pull in the attributes from _foo when -builtin is used made use of the -py3 switch to either do 'from ._foo import *' or "from _foo import *". This block of code no longer does this and instead checks the Python version at runtime to switch between the two syntaxes. In summary, swig-3.0.10 has been modified to ease the creation of wrapper modules that can be fully made part of a Python package. SWIG no longer assumes the dynamically linked C module is a global module. The dynamic module can now be placed into either the same package as the pure Python module or as a global module. Both locations are used by the Python wrapper to locate the C module. However, this could cause a backwards incompatibility with some code that was relying on the ability of "from package import _module" to pull attributes out of the package directly. If your code populates a module (which is also a package) with attributes that are SWIG generated modules which were not loaded in a conventional way, swig-3.0.8 and earlier may have worked due to 'from package import _module' bypassing a real import and pulling your module in as an attribute. This will no longer work. Since this is not a common (or even recommended) practice, most folk should not be affected. *** POTENTIAL INCOMPATIBILITY *** 2016-05-31: wsfulton Fix #690 - Smart pointer to %ignored class doesn't expose inherited methods. Regression introduced in swig-3.0.9. Version 3.0.9 (29 May 2016) =========================== 2016-05-24: mromberg [Python] Patch #612 - Add support for Python's implicit namespace packages. 2016-05-23: wsfulton [Ruby] Fix #602 - Error handling regression of opaque pointers introduced in swig-3.0.8 when C functions explicitly reset a pointer using 'DATA_PTR(self) = 0'. An ObjectPreviouslyDeleted error was incorrectly thrown when the pointer was used as a parameter. 2016-05-17: tamuratak [Ruby] Patch #651 - Correct overloaded function error message when function is using %newobject. 2016-05-17: aurelj [Ruby] Patch #582 - add support for docstring option in %module() 2016-05-14: wsfulton Fix #434 - Passing classes by value as parameters in director methods did not create a copy of the argument leading to invalid memory accesses if the object was used after the upcall into the target language. Passing arguments by value shouldn't give rise to these sorts of memory problems and so the objects are now copied and ownership of their lifetime is controlled by the target language. 2016-05-07: wsfulton Fix #611. Fix assertion handling defaultargs when using %extend for a template class and the extended methods contain default arguments. 2016-05-05: ejulian [Python] Patch #617. Fix operator/ wrappers. 2016-05-02: wsfulton Fix #669. Don't issue warning about ignoring base classes when the derived class is itself ignored. 2016-04-18: ianlancetaylor [Go] Fix use of goout typemap when calling base method by forcing the "type" attribute to the value we need. 2016-04-17: ianlancetaylor [Go] Fixes for Go 1.6: avoid returning Go pointers from directors that return string values; add a trailing 0 byte when treating Go string as C char*. 2016-04-06: smarchetto [Scilab] #552 Make Scilab runtime keep track of pointer types Instead of a Scilab pointer which has no type, SWIG Scilab maps a pointer to a structure tlist containing the pointer adress and its type. 2016-04-02: ahnolds [Python] Apply #598. Fix misleading error message when attempting to read a non-existent attribute. The previous cryptic error message: AttributeError: type object 'object' has no attribute '__getattr__' is now replaced with one mentioning the attribute name, eg: AttributeError: 'Foo' object has no attribute 'bar' 2016-04-02: derkuci [Python] Patch #610 to fix #607. Fix single arguments when using python -builtin -O with %feature("compactdefaultargs") 2016-03-31: wsfulton Fixes #594. Fix assertion for some languages when wrapping a C++11 enum class that is private in a class. Also don't wrap private enums for a few languages that attempted to do so. 2016-03-31: wsfulton [Java] unsigned long long marshalling improvements when a negative number is passed from Java to C. A cast to signed long long in the C layer will now result in the expected value. No change for positive numbers passed to C. Fixes #623. 2016-03-22: alexwarg [Lua] #398 Fix lua __getitem + inheritance The new handling of classes in Lua (not merging methods into the derived classes) breaks for classes that provide a __getitem function. The __getitem function prevents method calls to any method defined in a base class. This fix calls __getitem only if the member is not found using recursive lookup. 2016-03-18: ptomulik [Python] #563 Stop generating unnecessary _swigconstant helpers. 2016-03-16: richardbeare [R] #636 Add extra std::vector numeric types 2016-03-14: wsfulton [Java] Add std_array.i for C++11 std::array support. 2016-03-12: wsfulton [Java, C#, D] Fix static const char member variables wrappers with %javaconst(1) %csconst(1) or %dmanifestconst. This fixes the case when an integer is used as the initializer, such as: struct W { static const char w = 100; }; Fix generated code parsing enum values using char escape sequences when these values appear in the Java code (usually when using %javaconst(1)) such as: enum X { x1 = '\n', x2 = '\1' }; Similarly for static const member char variables such as: struct Y { static const char y = '\n'; } Likewise for D and %dmanifestconstant. For C# and %csconst(1), char values in C# are now hex escaped as C# doesn't support C octal escaping. 2016-03-11: wsfulton [Java C#] Add support for treating C++ base classes as Java interfaces instead of Java proxy classes. This enable some sort of support for multiple inheritance. The implementation is in swiginterface.i and provides additional macros (see Java.html for full documentation): %interface(CTYPE) %interface_impl(CTYPE) %interface_custom("PROXY", "INTERFACE", CTYPE) 2016-03-01: wsfulton Add rstrip encoder for use in %rename. This is like the strip encoder but strips the symbol's suffix instead of the prefix. The example below will rename SomeThingCls to SomeThing and AnotherThingCls to AnotherThing: %rename("%(rstrip:[Cls])s") ""; class SomeThingCls {}; struct AnotherThingCls {}; 2016-03-01: olly Fix isfinite() check to work with GCC6. Fixes https://github.com/swig/swig/issues/615 reported by jplesnik. 2016-02-17: olly [Python] Add missing keywords 'as' and 'with' to pythonkw.swg. 2016-02-07: kwwette [Octave] recognise various unary functions * Use __float__() for numeric conversions, e.g. when calling double() * Map various unary functions, e.g. abs() to __abs__(), see full list in section 32.3.10 of manual; only available in Octave 3.8.0 or later 2016-02-07: kwwette [Octave] export function swig_octave_prereq() for testing Octave version 2016-02-06: pjohangustavsson [C#] Fix duplicate symbol problems when linking the source generated from multiple SWIG modules into one shared library for the -namespace option. The namespace is now mangled into the global PInvoke function names. *** POTENTIAL INCOMPATIBILITY *** 2016-01-27: ahnolds [Python] Added support for differentiating between Python Bytes and Unicode objects using by defining SWIG_PYTHON_STRICT_BYTE_CHAR and SWIG_PYTHON_STRICT_UNICODE_WCHAR. 2016-01-27: steeve [Go] Ensure structs are properly packed between gc and GCC/clang. 2016-01-25: ahnolds [Python] Support the full Python test suite in -classic mode * Convert long/unsigned long/long long/unsigned long long to PyInt rather than PyLong when possible. Certain python functions like len() require a PyInt when operating on old-style classes. * Add support for static methods in classic mode, including support for pythonappend, pythonprepend, and docstrings. * Removing the use of __swig_getmethods__ for static member methods since they will always be found by the standard argument lookup * Fix a bug where the wrong type of exception was caught when checking for new-style class support 2016-01-23: ahnolds [Go] Enable support for the Go test-suite on OSX: * The linker on OSX requires that all symbols (even weak symbols) are defined at link time. Because the function _cgo_topofstack is only defined starting in Go version 1.4, we explicitly mark it as undefined for older versions of Go on OSX. * Avoid writing empty swigargs structs, since empty structs are not allowed in extern "C" blocks. 2016-01-12: olly [Javascript] Look for "nodejs" as well as "node", as it's packaged as the former on Debian. 2016-01-12: olly [Javascript] For v8 >= 4.3.0, use V8_MAJOR_VERSION. Fixes https://github.com/swig/swig/issues/561. 2016-01-10: ahnolds Improved size_t and ptrdiff_t typemaps to support large values on platforms where sizeof(size_t) > sizeof(unsigned long) and sizeof(ptrdiff_t) > sizeof(long). Version 3.0.8 (31 Dec 2015) =========================== 2015-12-30: wsfulton The pdf documentation is now generated by wkhtmltopdf and has colour for the code snippets just like the html documentation! 2015-12-23: ahnolds [Python] Fixes for conversion of signed and unsigned integer types: No longer check for PyInt objects in Python3. Because PyInt_Check and friends are #defined to the corresponding PyLong methods, this had caused errors in Python3 where values greater than what could be stored in a long were incorrectly interpreted as the value -1 with the Python error indicator set to OverflowError. This applies to both the conversions PyLong->long and PyLong->double. Conversion from PyLong to long, unsigned long, long long, and unsigned long long now raise OverflowError instead of TypeError in both Python2 and Python3 for PyLong values outside the range expressible by the corresponding C type. This matches the existing behavior for other integral types (signed and unsigned ints, shorts, and chars), as well as the conversion for PyInt to all numeric types. This also indirectly applies to the size_t and ptrdiff_t types, which depend on the conversions for unsigned long and long. 2015-12-19: wsfulton [Python] Python 2 Unicode UTF-8 strings can be used as inputs to char * or std::string types if the generated C/C++ code has SWIG_PYTHON_2_UNICODE defined. 2015-12-17: wsfulton Issues #286, #128 Remove ccache-swig.1 man page - please use the CCache.html docs instead. The yodl2man and yodl2html tools are no longer used and so SWIG no longer has a dependency on these packages which were required when building from git. 2015-12-16: zturner/coleb [Python] Fix Python3.5 interpreter assertions when objects are being deleted due to an existing exception. Most notably in generators which terminate using a StopIteration exception. Fixes #559 #560 #573. If a further exception is raised during an object destruction, PyErr_WriteUnraisable is used on this second exception and the original exception bubbles through. 2015-12-14: ahnolds/wsfulton [Python] Add in missing initializers for tp_finalize, nb_matrix_multiply, nb_inplace_matrix_multiply, ht_qualname ht_cached_keys and tp_prev. 2015-12-12: wsfulton Fix STL wrappers to not generate <: digraphs. For example std::vector<::X::Y> was sometimes generated, now corrected to std::vector< ::X::Y >. 2015-11-25: wsfulton [Ruby] STL ranges and slices fixes. Ruby STL container setting slices fixes: Setting an STL container wrapper slice better matches the way Ruby arrays work. The behaviour is now the same as Ruby arrays. The only exception is the default value used when expanding a container cannot be nil as this is not a valid type/value for C++ container elements. Obtaining a Ruby STL container ranges and slices fixes: Access via ranges and slices now behave identically to Ruby arrays. The fixes are mostly for out of range indices and lengths. - Zero length slice requests return an empty container instead of nil. - Slices which request a length greater than the size of the container no longer chop off the last element. - Ranges which used to return nil now return an empty array when the the start element is a valid index. Ruby STL container negative indexing support improved. Using negative indexes to set values works the same as Ruby arrays, eg %template(IntVector) std::vector; iv = IntVector.new([1,2,3,4]) iv[-4] = 9 # => [1,2,3,9] iv[-5] = 9 # => IndexError 2015-11-21: wsfulton [Ruby, Python] Add std::array container wrappers. These work much like any of the other STL containers except Python/Ruby slicing is somewhat limited because the array is a fixed size. Only slices of the full size are supported. 2015-10-10: wsfulton [Python] #539 - Support Python 3.5 and -builtin. PyAsyncMethods is a new member in PyHeapTypeObject. 2015-10-06: ianlancetaylor [Go] Don't emit a constructor function for a director class with an abstract method, since the function will always panic. 2015-10-01: wsfulton Fix %shared_ptr support for private and protected inheritance. - Remove unnecessary Warning 520: Derived class 'Derived' of 'Base' is not similarly marked as a smart pointer - Do not generate code that attempts to cast up the inheritance chain in the type system runtime in such cases as it doesn't compile and can't be used. Remove unnecessary warning 520 for %shared_ptr when the base class is ignored. 2015-10-01: vkalinin Fix #508: Fix segfault parsing anonymous typedef nested classes. 2015-09-26: wsfulton [Ruby] Add shared_ptr support 2015-09-13: kkaempf [Ruby] Resolve tracking bug - issue #225. The bug is that the tracking code uses a ruby hash and thus may allocate objects (Bignum) while running the GC. This was tolerated in 1.8 but is invalid (raises an exception) in 1.9. The patch uses a C hash (also used by ruby) instead. 2015-09-09: lyze [CFFI] Extend the "export" feature in the CFFI module to support exporting to a specified package. 2015-09-04: olly [Python] Fix docstrings for %callback functions. 2015-09-03: demi-rluddy [Go] Removed golang stringing for signed/unsigned char Changed default handling of signed char* and unsigned char* to be opaque pointers rather than strings, similarly to how other languages work. Any existing code relying on treating signed char* or unsigned char* as a string can restore the old behavior with typemaps.i by using %apply to copy the [unchanged] char* behavior. *** POTENTIAL INCOMPATIBILITY *** 2015-08-07: talby [Perl] tidy -Wtautological-constant-out-of-range-compare warnings when building generated code under clang 2015-08-07: xantares [Python] pep257 & numpydoc conforming docstrings: - Mono-line module docsstring - Rewrite autodoc parameters section in numpydoc style: https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt - One line summary should end with "." - Adds a blank line after class docstring 2015-08-05: vadz [Java] Make (char* STRING, size_t LENGTH) typemaps usable for strings of other types, e.g. "unsigned char*". Version 3.0.7 (3 Aug 2015) ========================== 2015-08-02: wsfulton [Java] Fix potential security exploit in generated Java classes. The swigCPtr and swigCMemOwn member variables in the generated Java classes are now declared 'transient' by default. Further details of the exploit in Android is being published in an academic paper as part of USENIX WOOT '15: https://www.usenix.org/conference/woot15/workshop-program/presentation/peles. In the unlikely event that you are relying on these members being serializable, then you will need to override the default javabody and javabody_derived typemaps to generate the old generated code. The relevant typemaps are in the Lib directory in the java.swg, boost_shared_ptr.i and boost_intrusive_ptr.i files. Copy the relevant default typemaps into your interface file and remove the 'transient' keyword. *** POTENTIAL INCOMPATIBILITY *** 2015-08-01: vadz Make configure --without-alllang option more useful: it can now be overridden by the following --with-xxx options, allowing to easily enable just one or two languages. 2015-07-30: wsfulton Fix #440 - Initialise all newly created arrays when using %array_functions and %array_class in the carrays.i library - bug is only relevant when using C++. 2015-07-29: wsfulton [Python] Improve indentation warning and error messages for code in the following directives: %pythonprepend %pythonappend %pythoncode %pythonbegin %feature("shadow") Old error example: Error: Line indented less than expected (line 3 of pythoncode) New error example: Error: Line indented less than expected (line 3 of %pythoncode or %insert("python") block) as no line should be indented less than the indentation in line 1 Old warning example: Warning 740: Whitespace prefix doesn't match (line 2 of %pythoncode or %insert("python") block) New warning example: Warning 740: Whitespace indentation is inconsistent compared to earlier lines (line 3 of %pythoncode or %insert("python") block) 2015-07-28: wsfulton [Python] Fix #475. Improve docstring indentation handling. SWIG-3.0.5 and earlier sometimes truncated text provided in the docstring feature. This occurred when the indentation (whitespace) in the docstring was less in the second or later lines when compared to the first line. SWIG-3.0.6 gave a 'Line indented less than expected' error instead of truncating the docstring text. Now the indentation for the 'docstring' feature is smarter and is appropriately adjusted so that no truncation occurs. 2015-07-22: wsfulton Support for special variable expansion in typemap attributes. Example usage expansion in the 'out' attribute (C# specific): %typemap(ctype, out="$*1_ltype") unsigned int& "$*1_ltype" is equivalent to the following as $*1_ltype expands to 'unsigned int': %typemap(ctype, out="unsigned int") unsigned int& "unsigned int" Special variables can be used within special variable macros too. Example usage expansion: %typemap(cstype) unsigned int "uint" %typemap(cstype, out="$typemap(cstype, $*1_ltype)") unsigned int& "$typemap(cstype, $*1_ltype)" Special variables are expanded first and hence the above is equivalent to: %typemap(cstype, out="$typemap(cstype, unsigned int)") unsigned int& "$typemap(cstype, unsigned int)" which then expands to: %typemap(cstype, out="uint") unsigned int& "uint" 2015-07-22: lindleyf Apply patch #439 - support for $typemap() (aka embedded typemaps or special variable macros) in typemap attributes. A simple example where $typemap() is expanded in the 'out' attribute (C# specific): %typemap(cstype) unsigned int "uint" %typemap(cstype, out="$typemap(cstype, unsigned int)") unsigned int& "$typemap(cstype, unsigned int)" is equivalent to: %typemap(cstype, out="uint") unsigned int& "uint" 2015-07-18: m7thon [Python] Docstrings provided via %feature("docstring") are now quoted and added to the tp_doc slot when using python builtin classes (-builtin). When no docstring is provided, the tp_doc slot is set to the fully qualified C/C++ class name. Github issues #445 and #461. 2015-07-17: kwwette [octave] Support Octave version 4.0.0 (thanks to patches from Orion Poplawski). 2015-07-07: wsfulton SWIG no longer generates a wrapper for a class' constructor if that class has any base class with a private destructor. This is because your compiler should not allow a class to be instantiated if a base has a private destructor. Some compilers do, so if you need the old behaviour, use the "notabstract" feature, eg: %feature("notabstract") Derived; class Base { ~Base() {} }; struct Derived : Base {}; Version 3.0.6 (5 Jul 2015) ========================== 2015-07-02: wsfulton Fix syntax error when the template keyword is used in types, eg: std::template vector v; 2015-07-02: ngladitz [Lua] Push characters as unformatted 1-character strings to avoid unprintable characters such as (char)127 being converted to "<\127>" with Lua 5.3 and later. (github PR #452) 2015-06-29: olly [Python] Improve handling of whitespace in %pythoncode. Previously SWIG looked at the indentation of the first line and removed that many characters from each subsequent line, regardless of what those characters were. This was made worse because SWIG's preprocessor removes any whitespace before a '#'. Fixes github issue #379, reported by Joe Orton. 2015-06-12: wsfulton [R] Fix #430 - call to SWIG_createNewRef in copyToC was incorrectly named. 2015-06-11: sghirate [C#] Patch #427 adds in new command line option -outfile to combine all the generated C# code into a single file. 2015-06-09: wsfulton Fix seg fault processing C++11 type aliasing. Issue #424. 2015-05-28: wsfulton [Python] Add new feature "python:cdefaultargs" to control default argument code generation. By default, SWIG attempts to convert C/C++ default argument values into Python values and generates code into the Python layer with these values. Recent versions of SWIG are able to convert more of these values, however, the new behaviour can be circumvented if desired via this new feature, such that the default argument values are obtained from the C layer and not the Python layer. For example: struct CDA { int fff(int a = 1, bool b = false); }; The default code generation in the Python layer is: class CDA(_object): ... def fff(self, a=1, b=False): return _default_args.CDA_fff(self, a, b) Adding the feature: %feature("python:cdefaultargs") CDA::fff; Results in: class CDA(_object): ... def fff(self, *args): return _default_args.CDA_fff(self, *args) Some code generation modes, eg -builtin and -fastproxy, are unaffected by this as the default values are always obtained from the C layer. 2015-05-27: wsfulton [Python] Deal with an integer as the default value of a typedef to bool parameter in the C++ prototype. See #327. Regression from 3.0.0 onwards. 2015-05-19: olly [Python] Fix warning when compiling generated code with MSVC. (Fixes https://sourceforge.net/p/swig/patches/351/ reported by Mateusz Szyma¿ski). 2015-05-14: wsfulton Fix seg fault wrapping shared_ptr of classes with private constructors and destructors. This also fixes the "unref" feature when used on classes with private destructors. 2015-05-10: wsfulton [Java] Fix multi-argument typemaps (char *STRING, size_t LENGTH) so that they can be applied to a wider range of types. Fixes #385. 2015-05-07: olly [Python] Deal with an integer as the default value of a bool parameter in the C++ prototype. Fixes github #327, reported by Greg Allen. 2015-05-07: LindleyF [Java] Allow feature("director") and feature("ref") to be used together. Github PR#403. 2015-05-05: olly Suppress warning 325 "Nested class not currently supported (Foo ignored)" when Foo has already been explicitly ignored with "%ignore". 2015-05-04: wsfulton Add support for friend templates, including operator overloading - fixes #196. Considering the example below, previously the operator gave a syntax error and friendfunc incorrectly warned with: "Warning 503: Can't wrap 'friendfunc<(Type)>' unless renamed to a valid identifier." template class MyClass { friend int friendfunc (double is, MyClass & x); friend int operator<< (double un, const MyClass &x); }; The following also previously incorrectly warned with: "Warning 302: Identifier 'template_friend' redefined (ignored)," template T template_friend(T); struct MyTemplate { template friend T template_friend(T); }; 2015-05-01: wsfulton Fix handling of conversion operators where the operator is split over multiple lines or has comments within the operator type. Fixes #401. Also fix similar problem with normal operators which gave a syntax error if split over multiple lines or had a comment within the operator declaration. 2015-04-30: olly Ignore unknown preprocessor directives which are inside an inactive conditional (github issue #394, reported by Dan Wilcox). Regression introduced in 3.0.3. 2015-04-27: vadz [Python] Fix "default" typemap used after an argument with "numinputs=0" (#377). 2015-04-24: wsfulton [Python] Fix #256. Code generated with '-builtin -modernargs' segfaults for any method taking zero arguments. Also fixes: "SystemError: error return without exception set" during error checking when using just -builtin and the incorrect number of arguments is passed to a class method expecting zero arguments. 2015-04-23: wsfulton [Java] Bug #386 - Memory leak fix in (char *STRING, size_t LENGTH) typemaps. 2015-04-23: vadz [Python] Make "default" typemap work again (#330, #377). 2015-04-23: vadz [Python] Fix the use of default values for the pointer types (#365, #376). 2015-04-23: wsfulton Fix 'make check-ccache' which is part of 'make check' when one of the CCACHE_ environment variables, for example CCACHE_DISABLE, is set. 2015-04-14: wsfulton Clearer warning message for badly constructed typecheck typemaps. For example, was: example.i:3: Warning 467: Overloaded foo(int) not supported (no type checking rule for 'int'). Now: example.i:3: Warning 467: Overloaded foo(int) not supported (incomplete type checking rule - no precedence level in typecheck typemap for 'int'). 2015-04-11: wsfulton [Java] Fix #353 - Linker multiple definition of 'ExceptionMatches' when using directors and multiple modules. 2015-04-11: wsfulton Merge #320 - Make __dict__ accessible for Python builtin classes. 2015-04-07: wsfulton Fix #375 - parsing of extern "C" and typedef for example: extern "C" typedef void (*Hook2_t)(int, const char *); extern "C" typedef int Integer; 2015-03-12: olly -DSWIG_DIRECTOR_STATIC is now supported for all languages with director support, not only Python and PHP. 2015-03-02: ianlancetaylor [Go] Add -cgo option, required for Go versions 1.5 and later. 2015-02-26: olly Fix segmentation fault when top==NULL, introduced by nested class handling (reported in issue#346 by Pawe¿ Tomulik). 2015-02-09: wsfulton [Guile] Fix generated code for static const char member variables when defined and declared inline. 2015-02-09: mishas [Go] Fix %import of files in sub directories. 2015-02-05: ianlancetaylor [Go] Ignore Go specific type maps (goin, goout, etc.) if they are empty. 2015-02-05: ianlancetaylor [Go] Generated Go code no longer calls _swig_goallocate or _swig_makegostring, as they will no longer work as of Go 1.5. Version 3.0.5 (31 Jan 2015) =========================== 2015-01-30: wsfulton [Python] Fix Python -classic and property setting. Setting properties on classic classes was broken in swig-3.0.3 by attempting to use __setattr__. This regression is fixed now by using __dict__ again when using -classic. Fixes patch #232. 2015-01-27: smarchetto [Scilab] Support for the Scilab language has been added 2015-01-23: olly [PHP] When wrapping a returned resource as an object, check if all cases wrap it in the same class, and if so eliminate the pointless switch statement wrapper we previously generated. 2015-01-22: wsfulton [Octave] Merge patch #297 for SF bug #1277 - Octave shared_ptr support 2015-01-15: wsfulton [Python] Merge patch #250 - Fixes for using %constant and objects (non-primitive types) 2015-01-15: wsfulton [C# Go] Merge patch #308 and fix #307 - C++11 strongly typed enum support in directors 2015-01-15: wsfulton [Python] Second fix for #294 #296 - Regression introduced in SWIG-3.0.3 when wrapping functions with default arguments, this time when using kwargs. Version 3.0.4 (14 Jan 2015) =========================== 2015-01-12: olly [PHP] Fix segfault in director upcall check when using PHP built with ZTS enabled. Fixes #155, reported by Pierre Labastie. 2015-01-12: vadz [Python] Fix #294 #296 - Regression introduced in SWIG-3.0.3 when wrapping functions with default arguments. Invalid or missing default arguments were sometimes being generated into the python layer. 2015-01-08: olly Allow C++11 "explicit constexpr". Fixes github issue #284 reported by Pawel Tomulik. Also handle "constexpr explicit" and "constexpr static". 2015-01-08: olly When reporting an error for a construct which hasn't been terminated when the end of the file is reached, report it at the start line rather than "EOF" as then tools like editors and IDEs will take you to a generally more useful place for fixing the problem. 2015-01-08: olly Improve error messages for a few cases which previously gave the one of the cryptic catch-all errors "Syntax error in input". 2015-01-08: olly Provide -cppext as a general command line option for setting the extension used for generated C++ files (previously it was specific to the PHP backend). Deprecate the equivalent -suffix option provided by the Ocaml backend, but continue to support that for now. Version 3.0.3 (30 Dec 2014) =========================== 2014-12-27: wsfulton Fix #280 - abort using all default template parameters within other template parameters. 2014-12-27: talby [Perl] Issue #282 perl5 archlib vs archlibexp [Perl] tidy "warning: duplicate 'extern' declaration specifier" when building generated code under clang 2014-12-18: wsfulton Add support for %constant and structs/classes - issue #272 2014-12-09: wsfulton Fix #245 - regression (since swig-3.0.0) in templated constructors. Templated constructors could not be instantiated - they were incorrectly ignored with a warning 504: "Function: xyz must have a return type. Ignored." 2014-12-07: wsfulton Add support for C++11 strongly typed enumerations. 2014-11-21: wsfulton [Java C#] Fix multiply defined error when using %rename of enum items when using the "simple enum" wrappers. 2014-10-28: vadz [Python] Patch #201 The generated .py file no longer uses *args for all Python parameters. Instead, the parameters are named using the C++ parameter names. "compactdefaultargs" feature can be enabled to restore the old behaviour. *** POTENTIAL INCOMPATIBILITY *** 2014-10-24: timotheecour [D] Patch #204 Use core.atomic.atomicOp to mutate shared variables 2014-10-21: wsfulton Fix issue #242 - Use of the "kwargs" feature no longer automatically turns on the "compactdefaultargs" feature if the target language does not support kwargs. This change affects all languages except Python and Ruby. *** POTENTIAL INCOMPATIBILITY *** 2014-10-10: diorcety [Python] Patch #232 Fix property access using directors 2014-10-06: wsfulton [Python] Fixes when using -builtin and std::vector/std::list wrappers to allow deletion of single elements, such as 'del vec[0]'. 2014-09-30: oliverb [Javascript] Merge patch #216 by Richie765 - Added support for many versions of v8 javascript. 2014-09-30: oliverb [Javascript] Merge patch #195 by zittix - Fixed JSClassRef declaration not using the static one. 2014-09-30: ianlancetaylor [Go] In configure script, require Go 1.1 or later. 2014-09-30: wsfulton [Python] Patch #207 - Fix No module error with -relativeimport when using single header file import. 2014-09-27: wsfulton Patch #208 - Initialise newly created array when using array_functions in the carrays.i library (C++ usage). 2014-09-27: wsfulton [Ruby] Patch #187 - Fix crash on shutdown of the Ruby interpreter if more than one module was loaded at a time when data is being shared between modules. 2014-09-27: wsfulton [Java] Patch #168 - Fix leak in Java director string handling after the Java upcall when called from a native thread. 2014-09-25: ianlancetaylor [Go] Adjust generated code to work with upcoming Go 1.4 release. 2014-09-23: wsfulton [Python] Add patch from Thomas Maslach to fix crash in wrappers when using -threads in the STL iterators (SwigPyIterator destructor). 2014-09-17: wsfulton [C#] Merge patch #229 from contre - Add bool array types to arrays_csharp.i 2014-09-12: olly [PHP] Add support for specifying any PHP interfaces a wrapped class implements, e.g.: %typemap("phpinterfaces") MyIterator "Iterator"; 2014-09-11: olly [PHP] Fix throwing a PHP exception through C++ from a subclassed director method - PHP NULL gets returned by the subclassed method in this case, so the directorout typemap needs to allow that (at least if an exception is active). 2014-09-09: ianlancetaylor [Go] Add goargout typemap. 2014-09-09: olly [PHP] Fix segmentation faults with directors in PHP >= 5.4, and reenable runme tests for director_basic testcase. Fix from pavel-charvat in issue#164. 2014-09-05: ianlancetaylor [Go] Add imtype, goin, goout, godirectorin, and godirectorout typemaps, to support writing Go code to convert between types. 2014-09-02: olly [Python] Fix regression in indentation of python code produced with -modern, introduced by changes in #188. Reported by fabiencastan in #218. 2014-09-01: olly Issue an error for unknown SWIG preprocessor directives, rather than quietly ignoring them. Reported by jrhelsey in issue#217. *** POTENTIAL INCOMPATIBILITY *** 2014-08-15: talby [Perl] Include guard fix for nested modules from Anthony Heading (SF Patch #350). 2014-08-04: wsfulton [C#] Merge patch #200 from gpetrou - Changed CSharp license header to include auto-generated tag so that StyleCop ignores the files. 2014-08-04: wsfulton [Java] Merge patch #198 from Yuval Kashtan - Support for java.nio.ByteBuffer mapping to unsigned char * in various.i in NIOBUFFER typemaps. 2014-07-14: ianlancetaylor [Go] Change struct definition to use void *, not uint8, so that the type is recorded as possibly containing pointers. This ensures that the 1.3 garbage collector does not collect pointers passed to C++ code. 2014-07-01: wsfulton Fix SF Bug #1375 - Expansion of the $parentclassname special variable incorrectly contains brackets in the expanded name. Version 3.0.2 (4 Jun 2014) ========================== 2014-06-02: v-for-vandal [Lua] Pull request #176: If class has no __eq implemented, then default __eq is generated. Default __eq compares actual pointers stored inside Lua userdata. 2014-06-02: vkalinin Fix #183 - %extend and unnamed nested structs 2014-05-28: kwwette Fix install failure when using an 'out of source' build using the shipped tarball - regression introduced in swig-3.0.1. 2014-05-24: kwwette [Octave] Remove deprecated -global/-noglobal command-line arguments *** POTENTIAL INCOMPATIBILITY *** Version 3.0.1 (27 May 2014) =========================== 2014-05-25: hfalcic [Python] Python 3 byte string output: use errors="surrogateescape" if available on the version of Python that's in use. This allows obtaining the original byte string (and potentially trying a fallback encoding) if the bytes can't be decoded as UTF-8. Previously, a UnicodeDecodeError would be raised with no way to treat the data as bytes or try another codec. 2014-05-18: vkalinin Bug #175 - Restore %extend to work for unnamed nested structures by using a C symbol comprising the outer structure name and unnamed variable instance name. 2014-05-15: kwwette Add #166 - 'make check' now works out of source. This required the examples to build out of source. The main languages have been tested - C#, Go, Guile, Java, Javascript, Lua, Octave, Perl, PHP, Python, Ruby and Tcl. 2014-05-01: Oliver Buchtala Javascript support added, see Javascript chapter in the documentation. 2014-05-01: olly [PHP] The generated __isset() method now returns true for read-only properties. 2014-04-24: kwwette [Go] Fix go ./configure parsing of gccgo --version, and goruntime.swg typo in __GNUC_PATCHLEVEL__ (SF Bug #1298) 2014-04-24: kwwette Fix {python|perl5|ruby|tcl}/java examples In Lib/gcj/cni.i, for compatibility with newer gcj versions: - remove JvAllocObject() which gcj no longer defines, from gcj Changelog: 2004-04-16 Bryce McKinlay * gcj/cni.h (JvAllocObject): Remove these obsolete, undocumented CNI calls. - change JvCreateJavaVM() argument from void* to JvVMInitArgs*, from gcj Changelog: 2005-02-23 Thomas Fitzsimmons PR libgcj/16923 ... (JvCreateJavaVM): Declare vm_args as JvVMInitArgs* rather than void*. *** POTENTIAL INCOMPATIBILITY *** 2014-04-08: wsfulton SF Bug #1366 - Remove duplicate declarations of strtoimax and strtoumax in inttypes.i 2014-04-08: wsfulton [Java C#] Enums which have been ignored via %ignore and are subsequently used are handled slightly differently. Type wrapper classes are now generated which are effectively a wrapper of an empty enum. Previously in Java uncompilable code was generated and in C# an int was used. 2014-04-04: wsfulton Fix regression in 3.0.0 where legal code following an operator<< definition might give a syntax error. SF Bug #1365. 2014-04-03: olly [PHP] Fix wrapping director constructors with default parameters with a ZTS-enabled build of PHP. 2014-04-02: olly [PHP] Pass the ZTS context we already have to avoid needing to call TSRMLS_FETCH, which is relatively expensive. 2014-04-02: olly [PHP] Pass ZTS context through to t_output_helper() so it works with a ZTS-enabled build of PHP. Reported by Pierre Labastie in github PR#155. 2014-03-28: wsfulton [Java C# D Go] Fixes for C enums used in an API and the definition of the enum has not been parsed. For D, this fixes a segfault in SWIG. The other languages now produce code that compiles, although the definition of the enum is needed in order to use the enum properly from the target language. 2014-03-23: v-for-vandal [Lua] Fix for usage of snprintf in Lua runtime which Visual Studio does not have. Version 3.0.0 (16 Mar 2014) =========================== 2014-03-16: wsfulton C++11 support initially developed as C++0x support by Matevz Jekovec as a Google Summer of Code project has been further extended. The C++11 support is comprehensive, but by no means complete or without limitations. Full details for each new feature in C++11 is covered in the CPlusPlus11.html chapter in the documentation which is included in SWIG and also available online at http://www.swig.org/Doc3.0/CPlusPlus11.html. 2014-03-14: v-for-vandal [Lua] Numerous Lua improvements: 1. %nspace support has been added. Namespaces are mapped to tables in the module, with the same name as the C++ namespace. 2. Inheritance is now handled differently. Each class metatable keeps a list of class bases instead of merging all members of all bases into the derived class. 3. The new metatables result in differences in accessing class members. For example: %module example struct Test { enum { TEST1 = 10, TEST2 = 20 }; static const int ICONST = 12; }; Now this can be used as follows: print(example.Test.TEST1) print(example.Test.ICONST) The old way was: print(example.Test_TEST1) print(example.Test_ICONST) 4. The special class metatable member ".constructor" was removed. Now SWIG generates the proxy function by itself and assigns it directly to the class table "__call" method. 5. eLua should also now support inheritance. 6. 'const' subtable in eLua is considered deprecated. Changes in behaviour: a. You can no longer assign to non-existing class members in classes without a __setitem__ method. It will cause a Lua error. b. You can no longer iterate over a module table and copy everything into the global namespace. Actually, this was never the case, but it is now explicitly prohibited. c. Now changing a base class will immediately affect all derived classes. d. There might be some issues with inheritance. Although the bases iteration scheme is the same as was used for merging base classes into derived one, some unknown issues may arise. The old metatable behaviour can be restored by using the -no-old-metatable-bindings option. *** POTENTIAL INCOMPATIBILITY *** 2014-03-06: wsfulton [Python] Change in default behaviour wrapping C++ bool. Only a Python True or False will now work for C++ bool parameters. This fixes overloading bool with other types. Python 2.3 minimum is now required for wrapping bool. When wrapping: const char* overloaded(bool value) { return "bool"; } const char* overloaded(int value) { return "int"; } Previous behaviour: >>> overloaded(False) 'int' >>> overloaded(True) 'int' >>> overloaded(0) 'int' Now we get the expected behaviour: >>> overloaded(False) 'bool' >>> overloaded(0) 'int' The consequence is when wrapping bool in non-overloaded functions: const char* boolfunction(bool value) { return value ? "true" : "false"; } The previous behaviour was very Pythonic: >>> boolfunction("") 'false' >>> boolfunction("hi") 'true' >>> boolfunction(12.34) 'true' >>> boolfunction(0) 'false' >>> boolfunction(1) 'true' Now the new behaviour more along the lines of C++ due to stricter type checking. The above calls result in an exception and need to be explicitly converted into a bool as follows: >>> boolfunction(0) Traceback (most recent call last): File "", line 1, in TypeError: in method 'boolfunction', argument 1 of type 'bool' >>> boolfunction(bool(0)) 'false' The old behaviour can be resurrected by passing the -DSWIG_PYTHON_LEGACY_BOOL command line parameter when executing SWIG. Typemaps can of course be written to customise the behaviour for specific parameters. *** POTENTIAL INCOMPATIBILITY *** 2014-03-06: wsfulton Fix SF Bug #1363 - Problem with method overloading when some methods are added by %extend and others are real methods and using template default parameters with smart pointers. This is noticeable as a regression since 2.0.12 when using the default smart pointer handling for some languages when the smart pointer wraps std::map and other STL containers. 2014-03-02: wsfulton [Python] SF Patch #346 from Jens Krueger. Correct exception thrown attempting to access a non-existent C/C++ global variable on the 'cvar' object. The exception thrown used to be a NameError. However, as this access is via a primary, an AttributeError is more correct and so the exception thrown now is an AttributeError. Reference: http://docs.python.org/2/reference/expressions.html#attribute-references *** POTENTIAL INCOMPATIBILITY *** 2014-03-01: wsfulton [Python] Patch #143 Fix type shown when using type() to include the module and package name when using -builtin. 2014-03-01: wsfulton [Python] SF patch #347 Fix missing argument count checking with -modern. Fixes regression introduced when builtin changes were introduced in SWIG-2.0.3. 2014-02-21: wsfulton [PHP] Fix warning suppression using %warnfilter for PHP reserved class names. 2014-02-19: olly [Lua] Add keyword warnings for Lua keywords and Basic Functions. 2014-02-19: olly -Wallkw now includes keywords for all languages with keyword warnings (previously Go and R were missing). 2014-02-19: olly [PHP] Update the lists of PHP keywords with new ones from PHP 5.4 and newer (and some missing ones from 5.3). Reserved PHP constants names are now checked against enum values and constants, instead of against function and method names. Built-in PHP function names no longer match methods added by %extend. Functions and methods named '__sleep', '__wakeup', 'not', 'parent', or 'virtual' are no longer needlessly renamed. 2014-02-15: wsfulton Fix the %$ismember %rename predicates to also apply to members added via %extend. Add %$isextendmember for %rename of members added via %extend. This can be used to distinguish between normal class/struct members and %extend members. For example '%$ismember, %$not %$isextendmember' will now identify just class/struct members. *** POTENTIAL INCOMPATIBILITY *** 2014-02-16: hfalcic [Python] Patch #137 - fix crashes/exceptions in exception handling in Python 3.3 2014-02-15: wsfulton [Java] Add support for the cdata library. 2014-02-08: vkalinin Nested class support added. This primarily allows SWIG to properly parse nested classes and keep the nested class information in the parse tree. Java and C# have utilised this information wrapping the C++ nested classes as Java/C# nested classes. The remaining target languages ignore nested classes as in previous versions. Help is needed by users of these remaining languages to design how C++ nested classes can be best wrapped. Please talk to us on the swig-devel mailing list if you think you can help. Previously, there was limited nested class support. Nested classes were treated as opaque pointers. However, the "nestedworkaround" feature provided a way to wrap a nested class as if it was a global class. This feature no longer exists and is replaced by the new "flatnested" feature. This effectively does the same thing with less manual code to be written. Please see the 'Nested classes' section in the documentation in SWIGPlus.html if you were previously using this feature. SWIG now parses the contents of nested classes where previously it did not. You may find that you will need to make adjustments to your interface file as effectively extra code is being wrapped. *** POTENTIAL INCOMPATIBILITY *** 2014-02-06: gjanssens [Guile] Patch #133. Make scm to string conversion work with non-ascii strings. Guile 2 has a completely rewritten string implementation. SWIG made some assumptions that are no longer valid as to the internals of guile's string representation. 2014-01-30: wsfulton [C#] Add new swigtype_inout.i library containing SWIGTYPE *& OUTPUT typemaps. Example usage wrapping: void f(XXX *& x) { x = new XXX(111); } would be: XXX x = null; f(out x); // use x x.Dispose(); // manually clear memory or otherwise leave out and leave it to the garbage collector 2014-01-21: ianlancetaylor [Go] Add %go_import directive. 2014-01-21: ianlancetaylor [Go] Add support for Go 1.3, not yet released. 2014-01-20: wsfulton Director exceptions (Swig::DirectorException) now derive from std::exception and hence provide the what() method. In Python and Ruby, this replaces the now deprecated DirectorException::getMessage() method. 2014-01-14: diorcety Patch #112 - Fix symbol resolution involving scopes that have multiple levels of typedefs - fixes some template resolutions as well as some typemap searches. 2014-01-11: wsfulton Fix and document the naturalvar feature override behaviour - the naturalvar feature attached to a variable name has precedence over the naturalvar feature attached to the variable's type. The overriding was not working when turning the feature off on the variable's name. Fix so that any use of the naturalvar feature will override the global setting. Previously when set globally by -naturalvar or %module(naturalvar=1), use of the naturalvar feature was not always honoured. 2014-01-06: ianlancetaylor [Go] Fix bug that broke using directors from a thread not created by Go. 2013-12-24: ptomulik [Python] SF Bug #1297 Resolve several issues related to python imports. For example, it's now possible to import modules having the same module names, but belonging in different packages. From the user's viewpoint, this patch gives a little bit more control on import statements generated by SWIG. The user may choose to use relative or absolute imports. Some details: - we (still) generate import statements in the form 'import a.b.c' which corresponds to absolute imports in python3 and (the only available) ambiguous one in python2. - added -relativeimport option to use explicit relative import syntax (python3), The "Python Packages" section in the documentation discusses how to work with importing packages including the new -relativeimport command line option. 2013-12-23: vadz [Octave, Perl, Python, R, Ruby, Tcl] Change the length of strings created from fixed-size char buffers in C code. This is a potential backwards compatibility break: a "char buf[5]" containing "ho\0la" was returned as a string of length 5 before, but is returned as a string of length 2 now. Also, it was possible to assign a (non-NUL-terminated) string "hello" to such a buffer before but now this fails and only "helo" can fit. Apply "char FIXSIZE[ANY]" typemaps to explicitly choose the old behaviour. *** POTENTIAL INCOMPATIBILITY *** 2013-12-23: talby [Perl] Add support for directors. 2013-12-18: ianlancetaylor [Go] Don't require that Go environment variables be set when running examples or testsuite when using Go 1 or later. 2013-12-17: ianlancetaylor [Go] Remove -longsize option (for backward compatibility, ignore it if seen). 2013-12-17: ianlancetaylor [Go] Add -go-pkgpath option. 2013-12-16: ianlancetaylor [Go] Update for Go 1.2 release. Add support for linking SWIG code directly into executable, rather than using a shared library. 2013-12-13: ianlancetaylor [Go] Add SWIG source file name as comments in generated files. This can be used by Go documentation tools. 2013-12-12: jleveque [Lua] Fix typo (wchar instead of wchar_t) which made wchar.i for Lua useless. 2013-12-12: vmiklos [PHP] PHP's peculiar call-time pass-by-reference feature was deprecated in PHP 5.3 and removed in PHP 5.4, so update the REF typemaps in phppointers.i to specify pass-by-reference in the function definition. Examples/php/pointer has been updated accordingly. 2013-12-12: olly [PHP] The usage of $input in PHP directorout typemaps has been changed to be consistent with other languages. The typemaps provided by SWIG have been updated accordingly, but if you have written your own directorout typemaps, you'll need to update $input to &$input (or make equivalent changes). *** POTENTIAL INCOMPATIBILITY *** 2013-11-27: vadz [C#, Java, Python] Add std_auto_ptr.i defining typemaps for returning std::auto_ptr<>. 2013-11-09: wsfulton [C#] Apply patch #79 from Brant Kyser - Remove using directives from the generated C# code and fully qualify the use of all .NET framework types in order to minimize potential name collisions from input files defining types, namespace, etc with the same name as .NET framework members. - Globally qualify the use of .NET framework types in the System namespace - Remove .NET 1.1 support, .NET 2 is the minimum for the C# module This is a potential backwards compatibility break if code has been added relying on these using statements that used to be generated: using System; using System.Runtime.InteropServices; The quick fix to add these back in is to add the -DSWIG2_CSHARP command line option when executing SWIG. See CSharp.html documentation for more info. *** POTENTIAL INCOMPATIBILITY *** 2013-11-05: wsfulton [Java] Fix some corner cases for the $packagepath/$javaclassname special variable substitution. 2013-11-05: wsfulton [Java] Apply patch #91 from Marvin Greenberg - Add director:except feature for improved exception handling in director methods for Java. 2013-10-15: vadz Allow using \l, \L, \u, \U and \E in the substitution part of %(regex:/pattern/subst/) inside %rename to change the case of the text being replaced. 2013-10-12: wsfulton [CFFI] Apply #96 - superclass not lispify 2013-10-12: wsfulton Merge in C++11 support from the gsoc2009-matevz branch where Matevz Jekovec first started the C++0x additions. Documentation of the C++11 features supported is in a new Chapter of the documentation, "SWIG and C++11" in Doc/Manual/CPlusPlus11.html. 2013-10-04: wsfulton Fix %naturalvar not having any affect on templated classes instantiated with an enum as the template parameter type. Problem reported by Vadim Zeitlin. 2013-09-20: wsfulton [Java] Fix a memory leak for the java char **STRING_ARRAY typemaps. Version 2.0.12 (9 Feb 2014) =========================== 2014-01-16: wsfulton [PHP] Fix compilation error in ZTS mode (64 bit windows) due to incorrect placement of TSRMLS_FETCH() in SWIG_Php_GetModule() as reported by Mark Dawson-Butterworth. 2014-01-13: kwwette [Octave] update support to Octave version 3.8.0 - Octave 3.8.0 no longer defines OCTAVE_API_VERSION_NUMBER, but 3.8.1 will define OCTAVE_{MAJOR,MINOR,PATCH}_VERSION instead: see http://hg.savannah.gnu.org/hgweb/octave/rev/b6b6e0dc700e So we now use a new macro SWIG_OCTAVE_PREREQ(major,minor,patch) to enable features requiring Octave version major.minor.patch or later. For Octave versions prior to 3.8.1, we reconstruct values for OCTAVE_{MAJOR,MINOR,PATCH}_VERSION based on OCTAVE_API_VERSION_NUMBER, extracted from Octave's ChangeLogs. An additional hack is needed to distinguish between Octave <= 3.2.x and 3.8.0, neither of which define OCTAVE_API_VERSION_NUMBER. - Octave 3.8.0 deprecates symbol_table::varref(), so remove its use for this and future versions of Octave. - Octave 3.8.0 removes octave_value::is_real_nd_array(), used in octave_swig_type::dims(). Its use is not required here, so remove it. - Retested against Octave versions 3.0.5, 3.2.4, 3.4.3, 3.6.4, and 3.8.0. - Updated Octave documentation with tested Octave versions, and added a warning against using versions <= 3.x.x, which are no longer tested. 2013-12-22: wsfulton C++11 support for new versions of erase and insert in the STL containers. The erase and insert methods in the containers use const_iterator instead of iterator in C++11. There are times when the methods wrapped must match the parameters exactly. Specifically when full type information for template types is missing or SWIG fails to look up the type correctly, for example: %include typedef float Real; %template(RealVector) std::vector; SWIG does not find std::vector::iterator because %template using typedefs does not always work and so SWIG doesn't know if the type is copyable and so uses SwigValueWrapper which does not support conversion to another type (const_iterator). This resulted in compilation errors when using the C++11 version of the containers. Closes #73 2013-10-17: wsfulton [R] Fix SF #1340 - Visual Studio compile error in C++ wrappers due to #include within extern "C" block. 2013-10-17: wsfulton [Python] Fix SF #1345 - Missing #include for offsetof when using -builtin. 2013-10-12: wsfulton [Lua] Apply #92 - missing return statements for SWIG_Lua_add_namespace_details() and SWIG_Lua_namespace_register(). Version 2.0.11 (15 Sep 2013) ============================ 2013-09-15: wsfulton [R] Fix attempt to free a non-heap object in OUTPUT typemaps for: unsigned short *OUTPUT unsigned long *OUTPUT signed long long *OUTPUT char *OUTPUT signed char*OUTPUT unsigned char*OUTPUT 2013-09-12: wsfulton [Lua] Pull Git patch #62. 1) Static members and static functions inside class can be accessed as ModuleName.ClassName.FunctionName (MemberName respectively). Old way such as ModuleName.ClassName_FunctionName still works. 2) Same goes for enums inside classes: ModuleName.ClassName.EnumValue1 etc. 2013-09-12: wsfulton [UTL] Infinity is now by default an acceptable value for type 'float'. This fix makes the handling of type 'float' and 'double' the same. The implementation requires the C99 isfinite() macro, or otherwise some platform dependent equivalents, to be available. Users requiring the old behaviour of not accepting infinity, can define a 'check' typemap wherever a float is used, such as: %typemap(check,fragment="") float, const float & %{ if ($1 < -FLT_MAX || $1 > FLT_MAX) { SWIG_exception_fail(SWIG_TypeError, "Overflow in type float"); } %} *** POTENTIAL INCOMPATIBILITY *** 2013-08-30: wsfulton [Lua] Pull Git patch #81: Include Lua error locus in SWIG error messages. This is standard information in Lua error messages, and makes it much easier to find bugs. 2013-08-29: wsfulton Pull Git patch #75: Handle UTF-8 files with BOM at beginning of file. Was giving an 'Illegal token' syntax error. 2013-08-29: wsfulton [C#] Pull Git patch #77: Allow exporting std::map using non-default comparison function. 2013-08-28: wsfulton [Python] %implicitconv is improved for overloaded functions. Like in C++, the methods with the actual types are considered before trying implicit conversions. Example: %implicitconv A; struct A { A(int i); }; class CCC { public: int xx(int i) { return 11; } int xx(const A& i) { return 22; } }; The following python code: CCC().xx(-1) will now return 11 instead of 22 - the implicit conversion is not done. 2013-08-23: olly [Python] Fix clang++ warning in generated wrapper code. 2013-08-16: wsfulton [Python] %implicitconv will now accept None where the implicit conversion takes a C/C++ pointer. Problem highlighted by Bo Peng. Closes SF patch #230. 2013-08-07: wsfulton [Python] SF Patch #326 from Kris Thielemans - Remove SwigPyObject_print and SwigPyObject_str and make the generated wrapper use the default python implementations, which will fall back to repr (for -builtin option). Advantages: - it avoids the swig user having to jump through hoops to get print to work as expected when redefining repr/str slots. - typing the name of a variable on the python prompt now prints the result of a (possibly redefined) repr, without the swig user having to do any extra work. - when redefining repr, the swig user doesn't necessarily have to redefine str as it will call the redefined repr - the behaviour is exactly the same as without the -builtin option while requiring no extra work by the user (aside from adding the %feature("python:slot...) statements of course) Disadvantage: - default str() will give different (but clearer?) output on swigged classes 2013-07-30: wsfulton [Python, Ruby] Fix #64 #65: Missing code in std::multimap wrappers. Previously an instantiation of a std::map was erroneously required in addition to an instantiation of std::multimap with the same template parameters to prevent compilation errors for the wrappers of a std::multimap. 2013-07-14: joequant [R] Change types file to allow for SEXP return values 2013-07-05: wsfulton [Python] Add %pythonbegin directive which works like %pythoncode, except the specified code is added at the beginning of the generated .py file. This is primarily needed for importing from __future__ statements required to be at the very beginning of the file. Example: %pythonbegin %{ from __future__ import print_function print("Loading", "Whizz", "Bang", sep=' ... ') %} 2013-07-01: wsfulton [Python] Apply SF patch #340 - Uninitialized variable fix in SWIG_Python_NonDynamicSetAttr when using -builtin. 2013-07-01: wsfulton [Python, Ruby, Ocaml] Apply SF patch #341 - fix a const_cast in generated code that was generating a <:: digraph when using the unary scope operator (::) (global scope) in a template type. 2013-07-01: wsfulton [Python] Add SF patch #342 from Christian Delbaere to fix some director classes crashing on object deletion when using -builtin. Fixes SF bug #1301. 2013-06-11: wsfulton [Python] Add SWIG_PYTHON_INTERPRETER_NO_DEBUG macro which can be defined to use the Release version of the Python interpreter in Debug builds of the wrappers. The Visual Studio .dsp example files have been modified to use this so that Debug builds will now work without having to install or build a Debug build of the interpreter. 2013-06-07: wsfulton [Ruby] Git issue #52. Fix regression with missing rb_complex_new function for Ruby versions prior to 1.9 using std::complex wrappers if just using std::complex as an output type. Also fix the Complex helper functions external visibility (to static by default). 2013-06-04: olly [PHP] Fix SWIG_ZTS_ConvertResourcePtr() not to dereference NULL if the type lookup fails. Version 2.0.10 (27 May 2013) ============================ 2013-05-25: wsfulton [Python] Fix Python 3 inconsistency when negative numbers are passed where a parameter expects an unsigned C type. An OverFlow error is now consistently thrown instead of a TypeError. 2013-05-25: Artem Serebriyskiy SVN Patch ticket #338 - fixes to %attribute macros for template usage with %arg. 2013-05-19: wsfulton Fix ccache-swig internal error bug due to premature file cleanup. Fixes SF bug 1319 which shows up as a failure in the ccache tests on Debian 64 bit Wheezy, possibly because ENABLE_ZLIB is defined. This is a corner case which will be hit when the maximum number of files in the cache is set to be quite low (-F option), resulting in a cache miss. 2013-05-09: kwwette [Octave] Fix bugs in Octave module loading: - fix a memory leak in setting of global variables - install functions only once, to speed up module loads 2013-04-28: gjanssens [Guile] Updates in guile module: - Add support for guile 2.0 - Drop support for guile 1.6 - Drop support for generating wrappers using guile's gh interface. All generated wrappers will use the scm interface from now on. - Deprecate -gh and -scm options. They are no longer needed. A warning will be issued when these options are still used. - Fix all tests and examples to have a successful travis test 2013-04-18: wsfulton Apply Patch #36 from Jesus Lopez to add support for $descriptor() special variable macro expansion in fragments. For example: %fragment("nameDescriptor", "header") %{ static const char *nameDescriptor = "$descriptor(Name)"; %} which will generate into the wrapper if the fragment is used: static const char *nameDescriptor = "SWIGTYPE_Name"; 2013-04-18: wsfulton Fix SF Bug #428 - Syntax error when preprocessor macros are defined inside of enum lists, such as: typedef enum { eZero = 0 #define ONE 1 } EFoo; The macros are silently ignored. 2013-04-17: wsfulton [C#] Pull patch #34 from BrantKyser to fix smart pointers in conjunction with directors. 2013-04-15: kwwette [Octave] Fix bugs in output of cleanup code. - Cleanup code is now written also after the "fail:" label, so it will be called if a SWIG_exception is raised by the wrapping function, consistent with other modules. - Octave module now also recognises the "$cleanup" special variable, if needed. 2013-04-08: kwwette Add -MP option to SWIG for generating phony targets for all dependencies. - Prevents make from complaining if header files have been deleted before the dependency file has been updated. - Modelled on similar option in GCC. 2013-04-09: olly [PHP] Add missing directorin typemap for char* and char[] which fixes director_string testcase failure. 2013-04-05: wsfulton [Ruby] SF Bug #1292 - Runtime fixes for Proc changes in ruby-1.9 when using STL wrappers that override the default predicate, such as: %template(Map) std::map >; 2013-04-05: wsfulton [Ruby] SF Bug #1159 - Correctly check rb_respond_to call return values to fix some further 1.9 problems with functors and use of Complex wrappers. 2013-04-02: wsfulton [Ruby] Runtime fixes for std::complex wrappers for ruby-1.9 - new native Ruby complex numbers are used. 2013-03-30: wsfulton [Ruby] Fix seg fault when using STL containers of generic Ruby types, GC_VALUE or LANGUAGE_OBJECT, on exit of the Ruby interpreter. More frequently observed in ruby-1.9. 2013-03-29: wsfulton [Ruby] Fix delete_if (reject!) for the STL container wrappers which previously would sometimes seg fault or not work. 2013-03-25: wsfulton [Python] Fix some undefined behaviour deleting slices in the STL containers. 2013-03-19: wsfulton [C#, Java, D] Fix seg fault in SWIG using directors when class and virtual method names are the same except being in different namespaces when the %nspace feature is not being used. 2013-02-19: kwwette Fix bug in SWIG's handling of qualified (e.g. const) variables of array type. Given the typedef a(7).q(volatile).double myarray // typedef volatile double[7] myarray; the type q(const).myarray // const myarray becomes a(7).q(const volatile).double // const volatile double[7] Previously, SwigType_typedef_resolve() produces the type q(const).a(7).q(volatile).double // non-sensical type which would never match %typemap declarations, whose types were parsed correctly. Add typemap_array_qualifiers.i to the test suite which checks for the correct behaviour. 2013-02-18: wsfulton Deprecate typedef names used as constructor and destructor names in %extend. The real class/struct name should be used. typedef struct tagEStruct { int ivar; } EStruct; %extend tagEStruct { EStruct() // illegal name, should be tagEStruct() { EStruct *s = new EStruct(); s->ivar = ivar0; return s; } ~EStruct() // illegal name, should be ~tagEStruct() { delete $self; } } For now these trigger a warning: extend_constructor_destructor.i:107: Warning 522: Use of an illegal constructor name 'EStruct' in %extend is deprecated, the constructor name should be 'tagEStruct'. extend_constructor_destructor.i:111: Warning 523: Use of an illegal destructor name 'EStruct' in %extend is deprecated, the destructor name should be 'tagEStruct'. These %extend destructor and constructor names were valid up to swig-2.0.4, however swig-2.0.5 ignored them altogether for C code as reported in SF bug #1306. The old behaviour of using them has been restored for now, but is officially deprecated. This does not apply to anonymously defined typedef classes/structs such as: typedef struct {...} X; 2013-02-17: kwwette When generating functions provided by %extend, use "(void)" for no-argument functions instead of "()". This prevents warnings when compiling with "gcc -Wstrict-prototypes". 2013-02-17: kwwette [Octave] Minor fix to autodoc generation: get the right type for functions returning structs. 2013-02-15: wsfulton Deprecate typedef names used in %extend that are not the real class/struct name. For example: typedef struct StructBName { int myint; } StructB; %extend StructB { void method() {} } will now trigger a warning: swig_extend.i:19: Warning 326: Deprecated %extend name used - the struct name StructBName should be used instead of the typedef name StructB. This is only partially working anyway (the %extend only worked if placed after the class definition). 2013-02-09: wsfulton [CFFI] Apply patch #22 - Fix missing package before &body 2013-01-29: wsfulton [Java] Ensure 'javapackage' typemap is used as it stopped working from version 2.0.5. 2013-01-28: wsfulton [Python] Apply patch SF #334 - Fix default value conversions "TRUE"->True, "FALSE"->False. 2013-01-28: wsfulton [Java] Apply patch SF #335 - Truly ignore constructors in directors with %ignore. 2013-01-18: Brant Kyser [Java] Patch #15 - Allow the use of the nspace feature without the -package commandline option. This works as long and the new jniclasspackage pragma is used to place the JNI intermediate class into a package and the nspace feature is used to place all exposed types into a package. 2013-01-15: wsfulton Fix Visual Studio examples to work when SWIG is unzipped into a directory containing spaces. 2013-01-15: wsfulton [C#] Fix cstype typemap lookup for member variables so that a fully qualified variable name matches. For example: %typemap(cstype) bool MVar::mvar "MyBool" struct MVar { bool mvar; }; 2013-01-11: Brant Kyser [Java, C#, D] SF Bug #1299 - Fix generated names for when %nspace is used on classes with the same name in two different namespaces. 2013-01-11: Vladimir Kalinin [C#] Add support for csdirectorin 'pre', 'post' and 'terminator' attributes. 2013-01-08: olly [PHP] Fix to work with a ZTS build of PHP (broken in 2.0.7). 2013-01-07: olly Fix bashism in configure, introduced in 2.0.9. 2013-01-06: wsfulton Pull patch #4 from ptomulik to fix SF Bug #1296 - Fix incorrect warning for virtual destructors in templates, such as: Warning 521: Illegal destructor name B< A >::~B(). Ignored. 2013-01-05: wsfulton [Python] Pull patch #3 from ptomulik to fix SF Bug #1295 - standard exceptions as classes using the SWIG_STD_EXCEPTIONS_AS_CLASSES macro. 2013-01-04: wsfulton [Java] Pull patch #2 from BrantKyser to fix SF Bug #1283 - fix smart pointers in conjuction with directors. 2013-01-03: wsfulton [Java] Pull patch #1 from BrantKyser to fix SF Bug #1278 - fix directors and nspace feature when multilevel namespaces are used. Version 2.0.9 (16 December 2012) ================================ 2012-12-16: wsfulton Fix garbage line number / empty file name reporting for some missing '}' or ')' error messages. 2012-12-15: kkaempf [Ruby] Apply patch 3530444, Class#methods and Class#constants returns array of symbols in Ruby 1.9+ 2012-12-14: kkaempf [Ruby] Apply patch 3530439 and finally replace all occurrences of the STR2CSTR() macro with StringValuePtr(). STR2CSTR was deprecated since years and got removed in Ruby 1.9 2012-12-14: kkaempf [Ruby] Applied patches #3530442 and 3530443 to adapt compile and runtime include paths to match Ruby 1.9+ 2012-12-14: wsfulton [CFFI] Fix #3161614 - Some string constants are incorrect 2012-12-13: wsfulton [CFFI] Fix #3529690 - Fix incorrect constant names. 2012-12-12: drjoe [R] add fix to finalizer that was missed earlier 2012-12-11: wsfulton [Python] Apply patch #3590522 - fully qualified package paths for Python 3 even if a module is in the same package. 2012-12-08: wsfulton [Python] Bug #3563647 - PyInt_FromSize_t unavailable prior to Python 2.5 for unsigned int types. 2012-12-08: wsfulton [Perl] Fix bug #3571361 - C++ comment in C wrappers. 2012-12-07: wsfulton [C#] Apply patch #3571029 which adds missing director support for const unsigned long long &. 2012-11-28: kwwette [Octave] Simplified module loading: now just the syntax $ example; is accepted, which loads functions globally but constants and variables relative to the current scope. This make module loading behaviour reliably consistent, and reduces problems when loading modules which depend on other modules which may not have been previously loaded. 2012-11-27: wsfulton [cffi] Fix junk output when wrapping single character literal constants. 2012-11-17: wsfulton [Tcl, Modula3] Add missing support for -outdir. 2012-11-17: wsfulton Fix segfaults when using filename paths greater than 1024 characters in length. 2012-11-14: wsfulton [ccache-swig] Apply patch #3586392 from Frederik Deweerdt to fix some error cases - incorrectly using memory after it has been deleted. 2012-11-09: vzeitlin [Python] Fix overflow when passing values greater than LONG_MAX from Python 3 for parameters with unsigned long C type. 2012-11-09: wsfulton Fix some feature matching issues for implicit destructors and implicit constructors and implicit copy constructors added with %copyctor. Previously a feature for these had to be fully qualified in order to match. Now the following will also match: %feature("xyz") ~XXX(); struct XXX {}; 2012-11-09: wsfulton Further consistency in named output typemap lookups for implicit constructors and destructors and implicit copy constructors added with %copyctor. Previously only the fully qualified name was being used, now the unqualified name will also be used. For example, previously: example.i:38: Searching for a suitable 'out' typemap for: void Space::More::~More Looking for: void Space::More::~More Looking for: void Now the unqualified name is also used: example.i:38: Searching for a suitable 'out' typemap for: void Space::More::~More Looking for: void Space::More::~More Looking for: void ~More Looking for: void 2012-11-02: wsfulton Fix some subtle named output typemap lookup misses, the fully qualified name was not always being used for variables, for example: struct Glob { int MyVar; }; Previously the search rules (as shown by -debug-tmsearch) for the getter wrapper were: example.i:44: Searching for a suitable 'out' typemap for: int MyVar Looking for: int MyVar Looking for: int Now the scope is named correctly: example.i:44: Searching for a suitable 'out' typemap for: int Glob::MyVar Looking for: int Glob::MyVar Looking for: int MyVar Looking for: int 2012-10-26: wsfulton Fix director typemap searching so that a typemap specified with a name will be correctly matched. Previously the name was ignored during the typemap search. Applies to the following list of typemaps: directorout, csdirectorout, cstype, imtype, ctype, ddirectorout, dtype, gotype, jtype, jni, javadirectorout. 2012-10-11: wsfulton Most of the special variables available for use in %exception are now also available for expansion in %extend blocks. These are: $name $symname $overname $decl $fulldecl $parentclassname $parentclasssymname, see docs on "Class extension" in SWIGPlus.html. Patch based on submission from Kris Thielemans. 2012-10-10: wsfulton Additional new special variables in %exception are expanded as follows: $parentclassname - The parent class name (if any) for a method. $parentclasssymname - The target language parent class name (if any) for a method. 2012-10-08: iant [Go] Generating Go code now requires using the -intgosize option to indicate the size of the 'int' type in Go. This is because the size of the type is changing from Go 1.0 to Go 1.1 for x86_64. 2012-09-14: wsfulton Add new warning if the empty template instantiation is used as a base class, for example: template class Base {}; %template() Base; class Derived : public Base {}; gives the following warning instead of silently ignoring the base: cpp_inherit.i:52: Warning 401: Base class 'Base< int >' has no name as it is an empty template instantiated with '%template()'. Ignored. cpp_inherit.i:51: Warning 401: The %template directive must be written before 'Base< int >' is used as a base class and be declared with a name. 2012-09-11: wsfulton [Java] Fix #3535304 - Direct use of a weak global reference in directors sometimes causing seg faults especially on Android. 2012-09-06: wsfulton [Java] Fix (char *STRING, size_t LENGTH) typemaps to accept NULL string. 2012-08-26: drjoe [R] make ExternalReference slot ref to contain reference 2012-08-26: drjoe [R] fix Examples/Makefile to use C in $(CC) rather than $(CXX) Version 2.0.8 (20 August 2012) ============================== 2012-08-15: wsfulton [Perl] Add size_type, value_type, const_reference to the STL containers. 2012-08-15: wsfulton [Python] Add discard and add methods to std::set wrappers so that pyabc.i can be used ensuring MutableSet is a valid abstract base class for std::set. As reported by Alexey Sokolov. Similarly for std::multiset. 2012-08-15: wsfulton [Python] Fix #3541744 - Missing PyInt_FromSize_t calls for Python 3. 2012-08-13: wsfulton [Java] Patch from David Baum to add the assumeoverride feature for Java directors to improve performance when all overridden methods can be assumed to be overridden. 2012-08-05: wsfulton [Python] #3530021 Fix unused variable warning. 2012-08-05: wsfulton [C#] Fix #3536360 - Invalid code sometimes being generated for director methods with many arguments. 2012-08-05: wsfulton [Perl] #3545877 - Don't undefine bool if defined by C99 stdbool.h - problem using Perl 5.16 and later. 2012-08-04: wsfulton Remove incorrect warning (314) about target language keywords which were triggered by using declarations and using directives. For example 'string' is a keyword in C#: namespace std { class string; } using std::string; 2012-07-21: wsfulton Fix display of pointers in various places on 64 bit systems - only 32 bits were being shown. 2012-07-21: wsfulton Fix gdb debugger functions 'swigprint' and 'locswigprint' to display to the gdb output window rather than stdout. This fixes display problems in gdbtui and the ensures the output appears where expected in other gdb based debuggers such as Eclipse CDT. 2012-07-20: kwwette [Octave] segfault-on-exit prevention hack now preserves exit status, and uses C99 _Exit(). 2012-07-02: wsfulton Fix Debian bug http://bugs.debian.org/672035, typemap copy failure - regression introduced in swig-2.0.5: %include using std::pair; %template(StrPair) pair; 2012-07-02: wsfulton Fix using declarations combined with using directives with forward class declarations so that types are correctly found in scope for templates. Example: namespace Outer2 { namespace Space2 { template class Thing2; } } using namespace Outer2; using Space2::Thing2; template class Thing2 {}; // STILL BROKEN void useit2(Thing2 t) {} void useit2a(Outer2::Space2::Thing2 t) {} void useit2b(::Outer2::Space2::Thing2 t) {} void useit2c(Space2::Thing2 t) {} namespace Outer2 { void useit2d(Space2::Thing2 t) {} } %template(Thing2Int) Thing2; 2012-06-30: wsfulton Fix template namespace problems for symbols declared with a forward class declarations, such as: namespace Space1 { namespace Space2 { template struct YYY; } template struct Space2::YYY { T yyy(T h) { return h; } }; void testYYY1(Space1::Space2::YYY yy) {} void testYYY2(Space2::YYY yy) {} void testYYY3(::Space1::Space2::YYY yy) {} } %template(YYYInt) Space1::Space2::YYY; 2012-06-30: wsfulton Fix namespace problems for symbols declared with a forward class declarations, such as: namespace Space1 { namespace Space2 { struct XXX; struct YYY; } struct Space2::YYY {}; struct Space1::Space2::XXX {}; void testXXX2(Space2::XXX xx) {} void testYYY2(Space2::YYY yy) {} } where xx and yy were not recognised as the proxy classes XXX and YYY. 2012-06-30: wsfulton Fix using declarations combined with using directives with forward class declarations so that types are correctly found in scope. namespace Outer2 { namespace Space2 { class Thing2; } } using namespace Outer2; using Space2::Thing2; class Thing2 {}; // None of the methods below correctly used the Thing2 proxy class void useit2(Thing2 t) {} void useit2a(Outer2::Space2::Thing2 t) {} void useit2b(::Outer2::Space2::Thing2 t) {} void useit2c(Space2::Thing2 t) {} namespace Outer2 { void useit2d(Space2::Thing2 t) {} } 2012-06-25: wsfulton Fix using declarations combined with using directives so that types are correctly found in scope. Example: namespace Outer2 { namespace Space2 { class Thing2 {}; } } using namespace Outer2; // using directive using Space2::Thing2; // using declaration void useit2(Thing2 t) {} Similarly for templated classes. 2012-05-29: wsfulton Fix #3529601 - seg fault when a protected method has the "director" feature but the parent class does not. Also fix similar problems with the allprotected feature. 2012-05-28: wsfulton Fix seg fault when attempting to warn about an illegal destructor - #3530055, 3530078 and #3530118. Version 2.0.7 (26 May 2012) =========================== 2012-05-26: wsfulton std::string typemap modifications so they can be used with %apply for other string classes. 2012-05-25: wsfulton [Lua] Fixes for -external-runtime to work again. 2012-05-22: szager [python] Disambiguate SWIG_From_unsigned_SS_int and SWIG_From_unsigned_SS_long. 2012-05-18: olly [PHP] Fix getters for template members. (SF#3428833, SF#3528035) 2012-05-14: wsfulton Fix some language's std::map wrappers to recognise difference_type, size_type, key_type and mapped_type. 2012-05-14: kwwette (signed off by xavier98) [Octave] Prevent Octave from seg-faulting at exit when SWIG modules are loaded, due to bugs in Octave's cleanup code: * Wrapping functions now declared with Octave DEFUN_DLD macro, and loaded through Octave's dynamic module loader * Global variables of swigref type are now assigned a new() copy of the swigref class, to prevent double-free errors * SWIG module at-exit cleanup function now created in Octave through eval(), so not dependent on loaded .oct library * For Octave versions 3.1.* to 3.3.*, register C-level at-exit function which terminates Octave immediately (with correct status code) without performing memory cleanup. This function can be controlled with macros in Lib/octave/octruntime.swg [Octave] New syntax for determing whether SWIG module should be loaded globally or non-globally. To load module "example" globally, type the module name $ example; as before; to load module non-globally, assign it to a variable: $ example = example; or $ ex = example; for a shorter (local) module name. -global/-noglobal command-line options and module command line are deprecated. Added usage info to module, so typing $ help example or incorrect usage should display proper usage, with examples. *** POTENTIAL INCOMPATIBILITY *** 2012-05-12: olly [PHP] Fix memory leak in code generated for a callback. Patch from SF bug #3510806. 2012-05-12: olly [PHP] Avoid using zend_error_noreturn() as it doesn't work with all builds of PHP (SF bug #3166423). Instead we now wrap it in a SWIG_FAIL() function which we annotate as "noreturn" for GCC to avoids warnings. This also reduces the size of the compiled wrapper (e.g. the stripped size is reduced by 6% for Xapian's PHP bindings). 2012-05-11: wsfulton [Java] SF patch #3522855 Fix unintended uninitialised memory access in OUTPUT typemaps. 2012-05-11: wsfulton [Java] SF patch #3522674 Fix possible uninitialised memory access in char **STRING_OUT typemap. 2012-05-11: wsfulton [Java] SF patch #3522611 Fix uninitialised size regression in char **STRING_ARRAY introduced in swig-2.0.6. 2012-05-11: wsfulton SF bug #3525050 - Fix regression introduced in swig-2.0.5 whereby defining one typemap method such as an 'out' typemap may hide another typemap method such as an 'in' typemap - only occurs when the type is a template type where the template parameters are the same via a typedef. 2012-05-10: olly [PHP] Fix the constant typemaps for SWIGTYPE, etc - previously these used the wrong name for renamed constants. Add autodoc_runme.php to the testsuite as a regression test for this. 2012-05-02: ianlancetaylor [Go] Remove compatibility support for gccgo 4.6. Using SWIG with gccgo will now require gccgo 4.7. Using SWIG with the more commonly used gc compiler is unaffected. 2012-05-01: wsfulton Fix generated code for C forward enum declarations in some languages. Version 2.0.6 (30 April 2012) ============================= 2012-04-25: wsfulton [Lua] Fix uninitialised variable in SWIGTYPE **OUTPUT typemaps as reported by Jim Anderson. 2012-04-28: wsfulton [Python] Fix compilation errors when wrapping STL containers on Mac OS X and possibly other systems. 2012-04-28: wsfulton [Java] Patch 3521811 from Leo Davis - char **STRING_ARRAY typemaps fixed to handle null pointers. Version 2.0.5 (19 April 2012) ============================= 2012-04-14: wsfulton [Lua] Apply patch #3517435 from Miles Bader - prefer to use Lua_pushglobaltable 2012-04-14: wsfulton [Ruby] Apply patch #3517769 from Robin Stocker to fix compile error on MacRuby using RSTRING_PTR. 2012-04-13: wsfulton Apply patch #3511009 from Leif Middelschulte for slightly optimised char * variable wrappers. 2012-04-13: wsfulton [Lua] Apply #3219676 from Shane Liesegang which adds: - support for %factory - a __tostring method - a __disown method 2012-04-13: wsfulton [Xml] Apply #3513569 which adds a catchlist to the xml output. 2012-04-05: olly [Lua] Add support for Lua 5.2 (patch SF#3514593 from Miles Bader) 2012-03-26: xavier98 [octave] Apply patch #3425993 from jgillis: add extra logic to the octave_swig_type::dims(void) method: it checks if the user has defined a __dims__ method and uses this in stead of returning (1,1) [octave] Apply patch #3424833 from jgillis: make is_object return true for swig types 2012-03-24: wsfulton [D] Apply #3502431 to fix duplicate symbols in multiple modules. 2012-03-21: wsfulton Fix #3494791 - %$isglobal for %rename matching. 2012-03-20: wsfulton Fix #3487706 and #3391906 - missing stddef.h include for ptrdiff_t when using %import for STL containers and compiling with g++-4.6. An include of stddef.h is now only generated when SWIG generates STL helper templates which require ptrdiff_t. If you were previously relying on "#include " always being generated when using a %include of an STL header, you may now need to add this in manually. 2012-03-16: wsfulton Apply patch #3392264 from Sebastien Bine to parse (unsigned) long long types in enum value assignment. 2012-03-16: wsfulton Apply patch #3505530 from Karl Wette to allow custom allocators in STL string classes for the UTL languages. 2012-03-13: wsfulton Apply patch #3468362 from Karl Wette to fix %include inside %define. 2012-03-13: wsfulton [Python, Ruby, Octave, R] Fix #3475492 - iterating through std::vector wrappers of enumerations. 2012-02-27: xavier98 (patches from Karl Wette) [Octave] Use -globals . to load global variables in module namespace [Octave] Comment declaration of unimplemented function swig_register_director [Octave] Fix OCTAVE_PATH in octave Makefiles [Octave] Add support for std::list - fix li_std_containers_int test [Octave] Fix imports test 2012-02-16: wsfulton [Java] Make generated support functions in arrays_java.i static so that generated code from multiple instances of SWIG can be compiled and linked together - problem reported by Evan Krause. 2012-01-24: wsfulton Fix crash with bad regex - bug #3474250. 2012-01-24: wsfulton [Python] Add Python stepped slicing support to the STL wrappers (std::vector, std::list). Assigning to a slice, reading a slice and deleting a slice with steps now work. For example: %template(vector_i) std::vector vi = vector_i(range(10)) print list(vi) vi[1:4:2] = [111, 333] print list(vi) del vi[3:10:3] print list(vi) print list(vi[::-1]) gives (same behaviour as native Python sequences such as list): [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] [0, 111, 2, 333, 4, 5, 6, 7, 8, 9] [0, 111, 2, 4, 5, 7, 8] [8, 7, 5, 4, 2, 111, 0] 2012-01-23: klickverbot [D] Correctly annotate function pointers with C linkage. [D] Exception and Error have become blessed names; removed d_exception_name test case. 2012-01-20: wsfulton [Python] Fix some indexing bugs in Python STL wrappers when the index is negative, eg: %template(vector_i) std::vector iv=vector_i([0,1,2,3,4,5]) iv[-7:] now returns [0, 1, 2, 3, 4, 5] instead of [5]. vv[7:9] = [22,33] now returns [0, 1, 2, 3, 4, 5, 22, 33] instead of "index out range" error. Also fix some segfaults when replacing ranges, eg when il is a std::list wrapper: il[0:2] = [11] 2012-01-17: wsfulton [Go] Fix forward class declaration within a class when used as a base. 2012-01-07: wsfulton [C#] Add support for %nspace when using directors. 2012-01-06: wsfulton [Java] Patch #3452560 from Brant Kyser - add support for %nspace when using directors. 2011-12-21: wsfulton The 'directorin' typemap now accepts $1, $2 etc expansions instead of having to use workarounds - $1_name, $2_name etc. 2011-12-20: wsfulton [Java] Add (char *STRING, size_t LENGTH) director typemaps. 2011-12-20: wsfulton [C#, Go, Java, D] Add support for the 'directorargout' typemap. 2011-12-20: wsfulton [Ocaml, Octave, PHP, Python, Ruby] Correct special variables in 'directorargout' typemap. This change will break any 'directorargout' typemaps you may have written. Please change: $result to $1 $input to $result Also fix the named 'directorargout' DIRECTOROUT typemaps for these languages which didn't previously compile and add in $1, $2 etc expansion. *** POTENTIAL INCOMPATIBILITY *** 2011-12-10: talby [perl5] SWIG_error() now gets decorated with perl source file/line number. [perl5] error handling now conforms to public XS api (fixes perl v5.14 issue). 2011-12-10: wsfulton [Android/Java] Fix directors to compile on Android. Added documentation and examples for Android. 2011-12-08: vadz Bug fix: Handle methods renamed or ignored in the base class correctly in the derived classes (they could be sometimes mysteriously not renamed or ignored there before). 2011-12-03: klickverbot [D] Fix exception glue code for newer DMD 2 versions. [D] Do not default to 32 bit glue code for DMD anymore. [D] Use stdc.config.c_long/c_ulong to represent C long types. 2011-12-01: szager [python] Fixed bug 3447426: memory leak in vector.__getitem__. 2011-11-30: wsfulton [R] Remove C++ comments from generated C code. 2011-11-27: olly [Python] Fix some warnings when compiling generated wrappers with certain GCC warning options (Debian bug #650246). 2011-11-28: wsfulton Fix #3433541 %typemap(in, numinputs=0) with 10+ arguments. 2011-11-28: olly [Perl] Fix warnings when compiling generated wrappers with certain GCC warning options (Debian bug #436711). 2011-11-28: olly [PHP] Update keyword list to include keywords added in PHP releases up to 5.3. 2011-11-25: wsfulton [C#] Provide an easy way to override the default visibility for the proxy class pointer constructors and getCPtr() method. The visibility is 'internal' by default and if multiple SWIG modules are being used and compiled into different assemblies, then they need to be 'public' in order to use the constructor or getCPtr() method from a different assembly. Use the following macros to change the visibilities in the proxy and type wrapper class: SWIG_CSBODY_PROXY(public, public, SWIGTYPE) SWIG_CSBODY_TYPEWRAPPER(public, public, public, SWIGTYPE) [Java] Provide an easy way to override the default visibility for the proxy class pointer constructors and getCPtr() method. The visibility is 'protected' by default and if multiple SWIG modules are being used and compiled into different packages, then they need to be 'public' in order to use the constructor or getCPtr() method from a different package. Use the following macros to change the visibilities in the proxy and type wrapper class: SWIG_JAVABODY_PROXY(public, public, SWIGTYPE) SWIG_JAVABODY_TYPEWRAPPER(public, public, public, SWIGTYPE) The default for Java has changed from public to protected for the proxy classes. Use the SWIG_JAVABODY_PROXY macro above to restore to the previous visibilities. *** POTENTIAL INCOMPATIBILITY *** 2011-11-22: szager [python] Bug 3440044: #ifdef out SWIG_Python_NonDynamicSetAttr if -builtin isn't being used, to avoid unnecessary binary incompatibilities between python installations. 2011-11-17: wsfulton Bug fix: Remove root directory from directory search list in Windows. 2011-11-13: wsfulton [Ruby] Apply patch #3421876 from Robin Stocker to fix #3416818 - same class name in different namespaces confusion when using multiple modules. 2011-11-11: wsfulton Fix pcre-build.sh to work with non-compressed tarballs - problem reported by Adrian Blakely. 2011-11-03: wsfulton Expand special variables in typemap warnings, eg: %typemap(in, warning="1000:Test warning for 'in' typemap for $1_type $1_name") int "..." 2011-11-01: wsfulton Fix named output typemaps not being used when the symbol uses a qualifier and contains a number, eg: %typemap(out) double ABC::m1 "..." 2011-10-24: talby [perl5] SF bug #3423119 - overload dispatch stack corruption fix. Better, but more research is needed on a stable path for tail calls in XS. Also, fix for large long longs in 32 bit perl. 2011-10-13: xavier98 [octave] Allow Octave modules to be re-loaded after a "clear all". 2011-09-19: wsfulton Fix regression introduced in swig-2.0.1 reported by Teemu Ikonone leading to uncompilable code when using typedef and function pointer references, for example: typedef int FN(const int &a, int b); void *typedef_call1(FN *& precallback, FN * postcallback); 2011-09-14: wsfulton [Lua] Patch #3408012 from Raman Gopalan - add support for embedded Lua (eLua) including options for targeting Lua Tiny RAM (LTR). 2011-09-14: wsfulton [C#] Add boost_intrusive_ptr.i library contribution from patch #3401571. 2011-09-13: wsfulton Add warnings for badly named destructors, eg: struct KStruct { ~NOT_KStruct() {} }; cpp_extend_destructors.i:92: Warning 521: Illegal destructor name ~NOT_KStruct. Ignored. 2011-09-13: wsfulton Fix %extend and destructors for templates. The destructor in %extend was not always wrapped, for example: %extend FooT { ~FooT() { delete $self; } // was not wrapped as expected }; template class FooT {}; %template(FooTi) FooT; 2011-09-13: wsfulton Fix special variables such as "$decl" and "$fulldecl" in destructors to include the ~ character. 2011-09-10: talby [perl5] SF bug #1481958 - Improve range checking for integer types. Enhance li_typemaps_runme.pl 2011-09-08: wsfulton Fix %extend on typedef classes in a namespace using the typedef name, for example: namespace Space { %extend CStruct { ... } typedef struct tagCStruct { ... } CStruct; } 2011-08-31: xavier98 [octave] patches from Karl Wette: improvements to module loading behavior; added example of friend operator to operator example; fixed octave panic/crash in 3.0.5; documentation improvements 2011-08-30: szager [python] Bug 3400486, fix error signalling for built-in constructors. 2011-08-26: wsfulton [Go] Fix file/line number display for "gotype" when using typemap debugging options -tmsearch and -tmused. 2011-08-26: wsfulton [C#, D] Fix %callback which was generating uncompilable code. 2011-08-25: wsfulton Fix constructors in named typedef class declarations as reported by Gregory Bronner: typedef struct A { A(){} // Constructor which was not accepted by SWIG B(){} // NOT a constructor --illegal, but was accepted by SWIG } B; For C code, the fix now results in the use of 'struct A *' instead of just 'B *' in the generated code when wrapping members in A, but ultimately this does not matter, as they are the same thing. 2011-08-23: wsfulton Fix %newobject when used in conjunction with %feature("ref") as reported by Jan Becker. The code from the "ref" feature was not always being generated for the function specified by %newobject. Documentation for "ref" and "unref" moved from Python to the C++ chapter. 2011-08-22: szager [python] Fixed memory leak with --builtin option (bug 3385089). 2011-08-22: wsfulton [Lua] SF patch #3394339 from Torsten Landschoff - new option -nomoduleglobal to disable installing the module table into the global namespace. Require call also returns the module table instead of a string. 2011-08-09: xavier98 Fix bug 3387394; Octave patches for 3.4.0 compatibility, etc. (from Karl Wette) 2011-08-04: wsfulton Add in $symname expansion for director methods. 2011-07-29: olly [PHP] Don't generate "return $r;" in cases where $r hasn't been set. This was basically harmless, except it generated a PHP E_NOTICE if the calling code had enabled them. 2011-07-26: wsfulton Fix scoping of forward class declarations nested within a class (for C++). Previously the symbol was incorrectly put into the outer namespace, eg namespace std { template struct map { class iterator; }; } iterator was scoped as std::iterator, but now it is correctly std::map::iterator; Also fixed is %template and template parameters that are a typedef when the template contains default template parameters, eg: namespace Std { template struct Map { typedef Key key_type; typedef T mapped_type; }; } typedef double DOUBLE; %template(MM) Std::Map; All symbols within Map will be resolved correctly, eg key_type and mapped_type no matter if the wrapped code uses Std::Map or std::Map or Std::Map Also fixes bug #3378145 - regression introduced in 2.0.4 - %template using traits. 2011-07-20 szager [python] Fix closure for tp_call slot. 2011-07-16: wsfulton [python] Fix director typemap using PyObject *. 2011-07-13: szager [python] SF patch #3365908 - Add all template parameters to map support code in std_map.i 2011-07-13: szager [python] Fix for bug 3324753: %rename member variables with -builtin. 2011-07-01: wsfulton Fix some scope and symbol lookup problems when template default parameters are being used with typedef. For example: template struct Foo { typedef XX X; typedef TT T; }; template struct UsesFoo { void x(typename Foo::T, typename Foo::X); }; Also fixes use of std::vector::size_type for Python as reported by Aubrey Barnard. 2011-06-23: olly [PHP] Fix director code to work when PHP is built with ZTS enabled, which is the standard configuration on Microsoft Windows. 2011-06-21: mutandiz [allegrocl] - various small tweaks and bug fixes. - Avoid name conflicts between smart pointer wrappers and the wrappers for the actual class. - Fix default typemaps for C bindings, which were incorrectly attempting to call non-existent destructors on user-defined types. - New feature, feature:aclmixins, for adding superclass to the foreign class wrappers. - Improve longlong typemaps. 2011-06-19: wsfulton Fix incorrect typemaps being used for a symbol within a templated type, eg: A::value_type would incorrectly use a typemap for type A. 2011-06-18: olly [Tcl] Fix variable declarations in middle of blocks which isn't permitted in C90 (issue probably introduced in 2.0.3 by patch #3224663). Reported by Paul Obermeier in SF#3288586. 2011-06-17: wsfulton [Java] SF #3312505 - slightly easier to wrap char[] or char[ANY] with a Java byte[] using arrays_java.i. 2011-06-13: wsfulton [Ruby, Octave] SF #3310528 Autodoc fixes similar to those described below for Python. 2011-06-10: wsfulton [Python] Few subtle bugfixes in autodoc documentation generation, - Unnamed argument names fix for autodoc levels > 0. - Display of template types fixed for autodoc levels > 1. - Fix SF #3310528 - display of typedef structs for autodoc levels > 1. - Add missing type for self for autodoc levels 1 and 3. - autodoc levels 2 and 3 documented. - Minor tweaks to autodoc style to conform with PEP8. 2011-05-30: olly [PHP] Fix handling of directors when -prefix is used. 2011-05-24: olly [PHP] Fix handling of methods of classes with a virtual base class (SF#3124665). Version 2.0.4 (21 May 2011) =========================== 2011-05-19: wsfulton [Guile] Patch #3191625 fixing overloading of integer types. 2011-05-19: wsfulton [Perl] Patch #3260265 fixing overloading of non-primitive types and integers in Perl 5.12 and later. 2011-05-19: wsfulton [Ruby] Fix %import where one of the imported files %include one of the STL include files such as std_vector.i. 2011-05-17: wsfulton [Java] Apply #3289851 from Alan Harder to fix memory leak in directors when checking for pending exceptions. 2011-05-17: wsfulton [Tcl] Apply #3300072 from Christian Delbaere to fix multiple module loading not always sharing variables across modules. 2011-05-16: xavier98 [octave] Fix an incompatibility with never versions of Octave. Case on Octave API >= 40 to handle rename of Octave_map to octave_map. [octave] Add support for y.__rop__(x) operators when x.__op__(y) doesn't exist. [octave] Allow global operators to be defined by SWIG-wrapped functions. [octave] Fix several bugs around module namespaces; add -global, -noglobal, -globals command line options to the module. 2011-05-14: wsfulton %varargs when used with a numeric argument used to create an additional argument which was intended to provide a guaranteed sentinel value. This never worked and now the additional argument is not generated. 2011-05-13: wsfulton [python] Additional fixes for python3.2 support. 2011-05-07: szager [python] Fixed PyGetSetDescr for python3.2. 2011-05-05: wsfulton [Lua, Python, Tcl] C/C++ prototypes shown in error message when calling an overloaded method with incorrect arguments improved to show always show fully qualified name and if a const method. Also fixed other Lua error messages in generated code which weren't consistently using the fully qualified C++ name - requested by Gedalia Pasternak. 2011-04-29: szager Bug 2635919: Convenience method to convert std::map to a python dict. 2011-04-29: szager [Python] Fixed bug 2811549: return non-const iterators from STL methods begin(), end(), rbegin(), rend(). 2011-04-25: szager [Python] Fixed bug 1498929: Access to member fields in map elements 2011-04-23: klickverbot [D] nspace: Correctly generate identifiers for base classes when not in split proxy mode. 2011-04-13: szager Fixed bug 3286333: infinite recursion with mutual 'using namespace' clauses. 2011-04-12: szager Fixed bug 1163440: vararg typemaps. 2011-04-12: szager Fixed bug #3285386: parse error from 'operator T*&()'. Added operator_pointer_ref test case to demonstrate. 2011-04-11: szager [Python] Fixed PyVarObject_HEAD_INIT to eliminate VC++ compiler errors about static initialization of struct members with pointers. 2011-04-11: wsfulton [Tcl] Apply patch #3284326 from Colin McDonald to fix some compiler warnings. 2011-04-11: szager [Python] Fixed PyVarObject_HEAD_INIT to eliminate VC++ compiler errors about static initialization of struct members with pointers. 2011-04-10: klickverbot [D] Fixed wrapping of enums that are type char, for example: enum { X = 'X'; } (this was already in 2.0.3 for C# and Java) 2011-04-10: klickverbot [D] nspace: Fixed referencing types in the root namespace when not in split proxy mode. 2011-04-09: szager [Python] Applied patch #1932484: migrate PyCObject to PyCapsule. 2011-04-09: szager [Python] Added preprocessor guards for python functions PyUnicode_AsWideChar and PySlice_GetIndices, which changed signatures in python3.2. 2011-04-07: wsfulton Fix wrapping of const array typedefs which were generating uncompilable code as reported by Karl Wette. 2011-04-03: szager [Python] Fixed the behavior of %pythonnondynamic to conform to the spec in Lib/pyuserdir.swg. 2011-04-03: szager [Python] Merged in the szager-python-builtin branch, adding the -builtin feature for python. The -builtin option may provide a significant performance gain in python wrappers. For full details and limitations, refer to Doc/Manual/Python.html. A small test suite designed to demonstrate the performance gain is in Examples/python/performance. 2011-04-01: wsfulton Add in missing wrappers for friend functions for some target languages, mostly the non-scripting languages like Java and C#. Version 2.0.3 (29 March 2011) ============================= 2011-03-29: wsfulton [R] Apply patch #3239076 from Marie White fixing strings for R >= 2.7.0 2011-03-29: wsfulton [Tcl] Apply patch #3248280 from Christian Delbaere which adds better error messages when the incorrect number or type of arguments are passed to overloaded methods. 2011-03-29: wsfulton [Tcl] Apply patch #3224663 from Christian Delbaere. 1. Fix when function returns a NULL value, a "NULL" command will be created in the Tcl interpreter and calling this command will cause a segmentation fault. 2. Previous implementation searches for class methods using a linear search causing performance issues in wrappers for classes with many member functions. The patch adds a method hash table to classes and changes method name lookup to use the hash table instead of doing a linear search. 2011-03-26: wsfulton [C#, Java] SF bug #3195112 - fix wrapping of enums that are type char, for example: enum { X = 'X'; } 2011-03-21: vadz Allow setting PCRE_CFLAGS and PCRE_LIBS during configuration to override the values returned by pcre-config, e.g. to allow using a static version of PCRE library. 2011-03-17: wsfulton [UTL] Add missing headers in generated STL wrappers to fix compilation with gcc-4.6. 2011-03-17: wsfulton Fix regression introduced in swig-2.0.2 where filenames with spaces were not found when used with %include and %import. Reported by Shane Liesegang. 2011-03-15: wsfulton [UTL] Fix overloading when using const char[], problem reported by David Maxwell. Similarly for char[ANY] and const char[ANY]. 2011-03-15: wsfulton [C#] Apply patch #3212624 fixing std::map Keys property. 2011-03-14: olly [PHP] Fix handling of overloaded methods/functions where some return void and others don't - whether this worked or not depended on the order they were encountered in (SF#3208299). 2011-03-13: klickverbot [D] Extended support for C++ namespaces (nspace feature). 2011-03-12: olly [PHP] Fix sharing of type information between multiple SWIG-wrapped modules (SF#3202463). 2011-03-09: wsfulton [Python] Fix SF #3194294 - corner case bug when 'NULL' is used as the default value for a primitive type parameter in a method declaration. 2011-03-07: olly [PHP] Don't use zend_error_noreturn() for cases where the function returns void - now this issue can only matter if you have a function or method which is directed and returns non-void. 2011-03-06: olly [PHP] Add casts to the typemaps for long long and unsigned long long to avoid issues when they are used with shorter types via %apply. 2011-03-02: wsfulton Templated smart pointers overloaded with both const and non const operator-> generated uncompilable code when the pointee was a class with either public member variables or static methods. Regression in 2.0.x reported as working in 1.3.40 by xantares on swig-user mailing list. Version 2.0.2 (20 February 2011) ================================ 2011-02-19: wsfulton [PHP] Add missing INPUT, OUTPUT and INOUT typemaps in the typemaps.i library for primitive reference types as well as signed char * and bool *. 2011-02-19: olly [PHP] Address bug in PHP on some platforms/architectures which results in zend_error_noreturn() not being available using SWIG_ZEND_ERROR_NORETURN which defaults to zend_error_noreturn but can be overridden when building the module by passing -DSWIG_ZEND_ERROR_NORETURN=zend_error to the compiler. This may result in compiler warnings, but should at least allow a module to be built on those platforms/architectures (SF#3166423). 2011-02-18: wsfulton Fix #3184549 - vararg functions and function overloading when using the -fastdispatch option. 2011-02-18: olly [PHP] An overloaded method which can return an object or a primitive type no longer causes SWIG to segfault. Reported by Paul Colby in SF#3168531. 2011-02-18: olly [PHP] Fix invalid erase during iteration of std::map in generated director code. Reported by Cory Bennett in SF#3175820. 2011-02-17: wsfulton Preprocessing now warns if extra tokens appear after #else and #end. 2011-02-16: wsfulton Fix #1653092 Preprocessor does not error out when #elif is missing an expression. This and other cases of missing preprocessor expressions now result in an error. 2011-02-14: wsfulton [Ocaml] Apply patch #3151788 from Joel Reymont. Brings Ocaml support up to date (ver 3.11 and 3.12), including std::string. 2011-02-13: wsfulton [Ruby] Apply patch #3176274 from James Masters - typecheck typemap for time_t. 2011-02-13: wsfulton Apply patch #3171793 from szager - protected director methods failing when -fvirtual is used. 2011-02-13: wsfulton Fix #1927852 - #include directives don't preprocess the file passed to it. The fix is for #include with -importall or -includeall, %include and %import, for example: #define FILENAME "abc.h" %include FILENAME 2011-02-12: wsfulton Fix #1940536, overactive preprocessor which was expanding defined(...) outside of #if and #elif preprocessor directives. 2011-02-05: wsfulton [MzScheme] SF #2942899 Add user supplied documentation to help getting started with MzScheme. Update chapter name to MzScheme/Racket accounting for the rename of MzScheme to Racket. 2011-02-05: wsfulton [C#] SF #3085906 - Possible fix running test-suite on Mac OS X. 2011-02-05: wsfulton SF #3173367 Better information during configure about Boost prerequisite for running the test-suite. 2011-02-05: wsfulton SF #3127633 Fix infinite loop in recursive typedef resolution. 2011-02-04: wsfulton [R] SF #3168676 Fix %rename not working for member variables and methods. 2011-02-04: wsfulton [clisp] SF #3148200 Fix segfault parsing nested unions. 2011-02-01: wsfulton [C#] Directors - a call to a method being defined in the base class, not overridden in a subclass, but again overridden in a class derived from the first subclass was not being dispatched correctly to the most derived class. See director_alternating.i for an example. 2011-02-01: wsfulton [C#, Java] Any 'using' statements in the protected section of a class were previously ignored with director protected (dirprot) mode. 2011-01-30: wsfulton Fix overloading with const pointer reference (SWIGTYPE *const&) parameters for a number of scripting languages. 2011-01-17: wsfulton New warning for smart pointers if only some of the classes in the inheritance chain are marked as smart pointer, eg, %shared_ptr should be used for all classes in an inheritance hierarchy, so this new warning highlights code where this is not the case. example.i:12: Warning 520: Base class 'A' of 'B' is not similarly marked as a smart pointer. example.i:16: Warning 520: Derived class 'C' of 'B' is not similarly marked as a smart pointer. 2011-01-14: wsfulton Added some missing multi-argument typemaps: (char *STRING, size_t LENGTH) and (char *STRING, int LENGTH). Documentation for this updated. Java patch from Volker Grabsch. 2011-01-11: iant Require Go version 7077 or later. 2010-12-30: klickverbot [C#, D, Java] Check for collision of parameter names with target language keywords when generating the director glue code. The situation in which the generated could would previously be invalid is illustrated in the new 'director_keywords' test case. 2010-12-23: wsfulton [C#] Fix $csinput special variable not being expanded for csvarin typemaps when used for global variables. Reported by Vadim Zeitlin. 2010-12-14: wsfulton Fix $basemangle expansion in array typemaps. For example if type is int *[3], $basemangle expands to _p_int. 2010-12-07: iant Check that we are using a sufficiently new version of the 6g or 8g Go compiler during configure time. If not, disable Go. Minimum version is now 6707. *** POTENTIAL INCOMPATIBILITY *** 2010-12-06: wsfulton Fix #3127394 - use of network paths on Windows/MSys. 2010-11-18: klickverbot [D] Added the D language module. 2010-11-12: vadz Fix handling of multiple regex-using %renames attached to the same declaration. For example, now %rename("%(regex:/^Set(.*)/put\\1/)s") ""; %rename("%(regex:/^Get(.*)/get\\1/)s") ""; works as expected whereas before only the last anonymous rename was taken into account. 2010-10-17: drjoe [R] Fix failure in overloaded functions which was breaking QuantLib-SWIG 2010-10-14: olly [PHP] Allow compilation on non-conforming Microsoft C++ compilers which don't accept: return function_returning_void(); Reported by Frank Vanden Berghen on the SWIG mailing list. 2010-10-12: wsfulton Fix unary scope operator (::) (global scope) regression introduced in 2.0.0, reported by Ben Walker. The mangled symbol names were incorrect, sometimes resulting in types being incorrectly treated as opaque types. Also fixes #2958781 and some other type problems due to better typedef resolution, eg std::vector::value_type didn't resolve to T * when it should have. The mangled type was incorrectly SWIGTYPE_std__vectorT_Test_p_std__allocatorT_Test_p_t_t__value_type and now it is correctly SWIGTYPE_p_Test. Version 2.0.1 (4 October 2010) ============================== 2010-10-03: wsfulton Apply patch #3066958 from Mikael Johansson to fix default smart pointer handling when the smart pointer contains both a const and non-const operator->. 2010-10-01: wsfulton Add -pcreversion option to display PCRE version information. 2010-10-01: olly [Ruby] Avoid segfault when a method node has no parentNode (SF#3034054). 2010-10-01: olly [Python] Allow reinitialisation to work with an embedded Python interpreter (patch from Jim Carroll in SF#3075178). 2010-09-28: wsfulton [C#] Apply patch from Tomas Dirvanauskas for std::map wrappers to avoid throwing exceptions with normal usage of iterators. 2010-09-27: olly [Python] Improve error message given when a parameter of the wrong type is passed to an overloaded method (SF#3027355). 2010-09-25: wsfulton Apply SF patch #3075150 - Java directors using static variables in named namespace. 2010-09-24: wsfulton More file and line error/warning reporting fixes where SWIG macros are used within {} braces (where the preprocessor expands macros), for example macros within %inline {...} and %fragment(...) {...} and nested structs. 2010-09-18: wsfulton More file and line error/warning reporting fixes for various inherited class problems. 2010-09-15: wsfulton A much improved debugging of SWIG source experience is now available and documented in the "Debugging SWIG" section in the Doc/Devel/internals.html file, including a swig.dbg support file for the gdb debugger. 2010-09-11: wsfulton Fix incorrect line number reporting in errors/warnings when a macro definition ends with '/' and it is not the end of a C comment. 2010-09-11: wsfulton Fix incorrect line number reporting in errors/warnings after parsing macro invocations with parameters given over more than one line. 2010-09-10: wsfulton Remove extraneous extra line in preprocessed output after including files which would sometimes lead to error/warning messages two lines after the end of the file. 2010-09-10: wsfulton Fix #2149523 - Incorrect line number reporting in errors after parsing macros containing C++ comments. 2010-09-08: olly [PHP] Fix handling of OUTPUT typemaps (Patch from Ryan in SF#3058394). 2010-09-03: wsfulton Fix erroneous line numbers in error messages for macro expansions, for example, the error message now points to instantiation of the macro, ie the last line here: #define MACRO2(a, b) #define MACRO1(NAME) MACRO2(NAME,2,3) MACRO1(abc) 2010-09-02: wsfulton Fix line numbers in error and warning messages for preprocessor messages within %inline, for example: %inline %{ #define FOOBAR 1 #define FOOBAR "hi" %} 2010-09-02: wsfulton Fix line numbers in error and warning messages which were cumulatively one less than they should have been after parsing each %include/%import - bug introduced in swig-1.3.32. Also fix line numbers in error and warning messages when new line characters appear between the %include / %import statement and the filename. 2010-08-30: wsfulton Fix line number and file name reporting for some macro preprocessor warnings. The line number of the macro argument has been corrected and the line number of the start of the macro instead of one past the end of the macro is used. Some examples: file.h:11: Error: Illegal macro argument name '..' file.h:19: Error: Macro 'DUPLICATE' redefined, file.h:15: Error: previous definition of 'DUPLICATE'. file.h:25: Error: Variable-length macro argument must be last parameter file.h:32: Error: Illegal character in macro argument name file.i:37: Error: Macro 'SIT' expects 2 arguments 2010-08-26: wsfulton Fix __LINE__ and __FILE__ expansion reported by Camille Gillot. Mostly this did not work at all. Also fixes SF #2822822. 2010-08-17: wsfulton [Perl] Fix corner case marshalling of doubles - errno was not being correctly set before calling strtod - patch from Justin Vallon - SF Bug #3038936. 2010-08-17: wsfulton Fix make distclean when some of the more obscure languages are detected by configure - fixes from Torsten Landschoff. 2010-07-28: wsfulton Restore configuring out of source for the test-suite since it broke in 1.3.37. As previously, if running 'make check-test-suite' out of source, it needs to be done by invoking configure with a relative path. Invoking configure with an absolute path will not work. Running the full 'make check' still needs to be done in the source tree. 2010-07-16: wsfulton Fix wrapping of function pointers and member function pointers when the function returns by reference. 2010-07-13: vadz Removed support for the old experimental "rxspencer" encoder and "[not]rxsmatch" in %rename (see the 01/16/2006 entry). The new and officially supported "regex" encoder and "[not]regexmatch" checks should be used instead (see the two previous entries). Please replace "%(rxspencer:[pat][subst])s" with "%(regex:/pat/subst/)s" when upgrading. Notice that you will also need to replace the back- references of form "@1" with the more standard "\\1" and may need to adjust your regular expressions syntax as the new regex encoder uses Perl-compatible syntax and not (extended) POSIX syntax as the old one. *** POTENTIAL INCOMPATIBILITY *** 2010-07-13: vadz Add "regexmatch", "regextarget" and "notregexmatch" which can be used to apply %rename directives to the declarations matching the specified regular expression only. The first two can be used interchangeably, both of the %renames below do the same thing: %rename("$ignore", regexmatch$name="Old$") ""; %rename("$ignore", regextarget=1) "Old$"; (namely ignore the declarations having "Old" suffix). "notregexmatch" restricts the match to only the declarations which do not match the regular expression, e.g. here is how to rename to lower case versions all declarations except those consisting from capital letters only: %rename("$(lowercase)s", notregexmatch$name="^[A-Z]+$") ""; 2010-07-13: vadz Add the new "regex" encoder that can be used in %rename, e.g. %rename("regex:/(\\w+)_(.*)/\\2/") ""; to remove any alphabetical prefix from all identifiers. The syntax of the regular expressions is Perl-like and PCRE library (http://www.pcre.org/) is used to implement this feature but notice that backslashes need to be escaped as usual inside C strings. Original patch from Torsten Landschoff. 2010-07-08: wsfulton Fix #3024875 - shared_ptr of classes with non-public destructors. This also fixes the "unref" feature when used on classes with non-public destructors. 2010-06-17: ianlancetaylor [Go] Add the Go language module. 2010-06-10: wsfulton [Lua] Fix SWIG_lua_isnilstring multiply defined when using multiple modules and wrapping strings. Patch from 'Number Cruncher'. 2010-06-10: olly [PHP] Fix directors to correctly call a method with has a different name in PHP to C++ (we were always using the C++ name in this case). 2010-06-03: wsfulton Fix uncompilable code when %rename results in two enum items with the same name. Reported by Vadim Zeitlin. Version 2.0.0 (2 June 2010) =========================== 2010-06-02: wsfulton [C#] Fix SWIG_STD_VECTOR_ENHANCED macro used in std::vector to work with types containing commas, for example: SWIG_STD_VECTOR_ENHANCED(std::pair< double, std::string >) 2010-06-01: wsfulton Add in std_shared_ptr.i for wrapping std::shared_ptr. Requires the %shared_ptr macro like in the boost_shared_ptr.i library. std::tr1::shared_ptr can also be wrapped if the following macro is defined: #define SWIG_SHARED_PTR_SUBNAMESPACE tr1 %include shared_ptr is also documented in Library.html now. 2010-05-27: wsfulton Add the ability for $typemap special variable macros to call other $typemap special variable macros, for example: %typemap(cstype) CC "CC" %typemap(cstype) BB "$typemap(cstype, CC)" %typemap(cstype) AA "$typemap(cstype, BB)" void hah(AA aa); This also fixes C# std::vector containers of shared_ptr and %shared_ptr. Also added diagnostics for $typemap with -debug-tmsearch, for example, the above displays additional diagnostic lines starting "Containing: ": example.i:34: Searching for a suitable 'cstype' typemap for: AA aa Looking for: AA aa Looking for: AA Using: %typemap(cstype) AA Containing: $typemap(cstype, BB) example.i:31: Searching for a suitable 'cstype' typemap for: BB Looking for: BB Using: %typemap(cstype) BB Containing: $typemap(cstype, CC) example.i:29: Searching for a suitable 'cstype' typemap for: CC Looking for: CC Using: %typemap(cstype) CC 2010-05-26: olly Fix %attribute2ref not to produce a syntax error if the last argument (AccessorMethod) is omitted. Patch from David Piepgras in SF#2235756. 2010-05-26: olly [PHP] When using %throws or %catches, SWIG-generated PHP5 wrappers now throw PHP Exception objects instead of giving a PHP error of type E_ERROR. This change shouldn't cause incompatibility issues, since you can't set an error handler for E_ERROR, so previously PHP would just exit which also happens for unhandled exceptions. The benefit is you can now catch them if you want to. Fixes SF#2545578 and SF#2955522. 2010-05-25: olly [PHP] Add missing directorin typemap for const std::string &. Fixes SF#3006404 reported by t-Legiaw. 2010-05-23: wsfulton [C#] Fix #2957375 - SWIGStringHelper and SWIGExceptionHelper not always being initialized before use in .NET 4 as the classes were not marked beforefieldinit. A static constructor has been added to the intermediary class like this: %pragma(csharp) imclasscode=%{ static $imclassname() { } %} If you had added your own custom static constructor to the intermediary class in the same way as above, you will have to modify your approach to use static variable initialization or define SWIG_CSHARP_NO_IMCLASS_STATIC_CONSTRUCTOR - See csharphead.swg. *** POTENTIAL INCOMPATIBILITY *** 2010-05-23: wsfulton Fix #2408232. Improve shared_ptr and intrusive_ptr wrappers for classes in an inheritance hierarchy. No special treatment is needed for derived classes. The proxy class also no longer needs to be specified, it is automatically deduced. The following macros are deprecated: SWIG_SHARED_PTR(PROXYCLASS, TYPE) SWIG_SHARED_PTR_DERIVED(PROXYCLASS, BASECLASSTYPE, TYPE) and have been replaced by %shared_ptr(TYPE) Similarly for intrusive_ptr wrappers, the following macro is deprecated: SWIG_INTRUSIVE_PTR(PROXYCLASS, TYPE) SWIG_INTRUSIVE_PTR_DERIVED(PROXYCLASS, BASECLASSTYPE, TYPE) and have been replaced by %intrusive_ptr(TYPE) 2010-05-21: olly [PHP] Stop generating a bogus line of code in certain constructors. This was mostly harmless, but caused a PHP notice to be issued, if enabled (SF#2985684). 2010-05-18: wsfulton [Java] Fix member pointers on 64 bit platforms. 2010-05-14: wsfulton Fix wrapping of C++ enum boolean values reported by Torsten Landschoff: typedef enum { PLAY = true, STOP = false } play_state; 2010-05-14: olly [PHP] Fix wrapping of global variables which was producing uncompilable code in some cases. 2010-05-12: drjoe [R] Add two more changes from Wil Nolan. Get garbage collection to work. Implement newfree 2010-05-09: drjoe Fix bug reported by Wil Nolan change creation of string so that R 2.7.0+ can use char hashes 2010-05-07: wsfulton Apply patch #2955146 from Sergey Satskiy to fix expressions containing divide by operator in constructor initialization lists. 2010-05-05: wsfulton [R] Memory leak fix handling const std::string & inputs, reported by Will Nolan. 2010-05-01: wsfulton Typemap matching enhancement for non-default typemaps. Previously all qualifiers were stripped in one step, now they are stripped one at a time starting with the left most qualifier. For example, int const*const is first stripped to int *const then int *. *** POTENTIAL INCOMPATIBILITY *** 2010-04-25: bhy [Python] Fix #2985655 - broken constructor renaming. 2010-04-14: wsfulton Typemap fragments are now official and documented in Typemaps.html. 2010-04-09: wsfulton [Ruby] Fix #2048064 and #2408020. Apply Ubuntu patch to fix Ruby and std::vector wrappers with -minherit. https://bugs.launchpad.net/ubuntu/+source/swig1.3/+bug/522874 2010-04-09: wsfulton [Mzscheme] Apply Ubuntu patch to fix std::map wrappers: https://bugs.launchpad.net/ubuntu/+source/swig1.3/+bug/203876 2010-04-09: wsfulton [Python] Apply patch #2952374 - fix directors and the -nortti option. 2010-04-09: wsfulton [Lua] Fix #2887254 and #2946032 - SWIG_Lua_typename using wrong stack index. 2010-04-03: wsfulton [Python] Fix exceptions being thrown with the -threads option based on patch from Arto Vuori. Fixes bug #2818499. 2010-04-03: wsfulton Fix Makefile targets: distclean and maintainer-clean 2010-04-02: wsfulton [Lua] Fix char pointers, wchar_t pointers and char arrays so that nil can be passed as a valid value. Bug reported by Gedalia Pasternak. 2010-04-01: wsfulton Numerous subtle typemap matching rule fixes when using the default type. The typemap matching rules are to take a type and find the best default typemap (SWIGTYPE, SWIGTYPE* etc), then look for the next best match by reducing the chosen default type. The type deduction now follows C++ class template partial specialization matching rules. Below are the set of changes made showing the default type deduction along with the old reduced type and the new version of the reduced type: SWIGTYPE const &[ANY] new: SWIGTYPE const &[] old: SWIGTYPE (&)[ANY] SWIGTYPE *const [ANY] new: SWIGTYPE const [ANY] old: SWIGTYPE *[ANY] SWIGTYPE const *const [ANY] new: SWIGTYPE *const [ANY] old: SWIGTYPE const *[ANY] SWIGTYPE const *const & new: SWIGTYPE *const & old: SWIGTYPE const *& SWIGTYPE *const * new: SWIGTYPE const * old: SWIGTYPE ** SWIGTYPE *const & new: SWIGTYPE const & old: SWIGTYPE *& Additionally, a const SWIGTYPE lookup is used now for any constant type. Some examples, where T is some reduced type, eg int, struct Foo: T const new: SWIGTYPE const old: SWIGTYPE T *const new: SWIGTYPE *const old: SWIGTYPE * T const[] new: SWIGTYPE const[] old: SWIGTYPE[] enum T const new: enum SWIGTYPE const old: enum SWIGTYPE T (*const )[] new: SWIGTYPE (*const )[] old: SWIGTYPE (*)[] Reminder: the typemap matching rules can now be seen for any types being wrapped by using either the -debug-tmsearch or -debug-tmused options. In practice this leads to some subtle matching rule changes and the majority of users won't notice any changes, except in the prime area of motivation for this change: Improve STL containers of const pointers and passing const pointers by reference. This is fixed because many of the STL containers use a type 'T const&' as parameters and when T is a const pointer, for example, 'K const*', then the full type is 'K const*const&'. This means that the 'SWIGTYPE *const&' typemaps now match when T is either a non-const or const pointer. Furthermore, some target languages incorrectly had 'SWIGTYPE *&' typemaps when these should have been 'SWIGTYPE *const&'. These have been corrected (Java, C#, Lua, PHP). *** POTENTIAL INCOMPATIBILITY *** 2010-03-13: wsfulton [Java] Some very old deprecated pragma warnings are now errors. 2010-03-13: wsfulton Improve handling of file names and directories containing double/multiple path separators. 2010-03-10: mutandiz (Mikel Bancroft) [allegrocl] Use fully qualified symbol name of cl::identity in emit_defun(). 2010-03-06: wsfulton [Java] The intermediary JNI class modifiers are now public by default meaning these intermediary low level functions are now accessible by default from outside any package used. The proxy class pointer constructor and getCPtr() methods are also now public. These are needed in order for the nspace option to work without any other mods. The previous default of protected access can be restored using: SWIG_JAVABODY_METHODS(protected, protected, SWIGTYPE) %pragma(java) jniclassclassmodifiers = "class" 2010-03-06: wsfulton [C#] Added the nspace feature for C#. Documentation for the nspace feature is now available. 2010-03-04: wsfulton Added the nspace feature. This adds some improved namespace support. Currently only Java is supported for target languages, where C++ namespaces are automatically translated into Java packages. The feature only applies to classes,struct,unions and enums declared within a namespace. Methods and variables declared in namespaces still effectively have their namespaces flattened. Example usage: %feature(nspace) Outer::Inner1::Color; %feature(nspace) Outer::Inner2::Color; namespace Outer { namespace Inner1 { struct Color { ... }; } namespace Inner2 { struct Color { ... }; } } For Java, the -package option is also required when using the nspace feature. Say we use -package com.myco, the two classes can then be accessed as follows from Java: com.myco.Outer.Inner1.Color and com.myco.Outer.Inner2.Color. 2010-02-27: wsfulton [Python] Remove -dirvtable from the optimizations included by -O as it this option currently leads to memory leaks as reported by Johan Blake. 2010-02-27: wsfulton License code changes: SWIG Source is GPL-v3 and library code license is now clearer and is provided under a very permissive license. See http://www.swig.org/legal.html. 2010-02-13: wsfulton [Ruby] A few fixes for compiling under ruby-1.9.x including patch from 'Nibble'. 2010-02-13: wsfulton [Ruby] Apply patch from Patrick Bennett to fix RARRAY_LEN and RARRAY_PTR usage for Ruby 1.9.x used in various STL wrappers. 2010-02-13: wsfulton [C#, Java] Fix incorrect multiply defined symbol name error when an enum item and class name have the same name, as reported by Nathan Krieger. Example: class Vector {}; namespace Text { enum Preference { Vector }; } This also fixes other incorrect corner case target language symbol name clashes. 2010-02-11: wsfulton Add the -debug-lsymbols option for displaying the target language layer symbols. 2010-02-09: wsfulton Fix -MM and -MMD options on Windows. They were not omitting files in the SWIG library as they should be. 2010-02-08: wsfulton Fix #1807329 - When Makefile dependencies are being generated using the -M family of options on Windows, the file paths have been corrected to use single backslashes rather than double backslashes as path separators. 2010-02-06: wsfulton Fix #2918902 - language specific files not being generated in correct directory on Windows when using forward slashes for -o, for example: swig -python -c++ -o subdirectory/theinterface_wrap.cpp subdirectory/theinterface.i 2010-02-05: wsfulton Fix #2894405 - assertion when using -xmlout. 2010-01-28: wsfulton Fix typemap matching bug when a templated type has a typemap both specialized and not specialized. For example: template struct XX { ... }; %typemap(in) const XX & "..." %typemap(in) const XX< int > & "..." resulted in the 2nd typemap being applied for all T in XX< T >. 2010-01-22: wsfulton Fix #2933129 - typemaps not being found when the unary scope operator (::) is used to denote global scope, the typemap is now used in situations like this: struct X {}; %typemap(in) const X & "..." void m(const ::X &); and this: struct X {}; %typemap(in) const ::X & "..." void m(const X &); 2010-01-20: wsfulton Fix some unary scope operator (::) denoting global scope problems in the types generated into the C++ layer. Previously the unary scope operator was dropped in the generated code if the type had any sort of qualifier, for example when using pointers, references, like ::foo*, ::foo&, bar< ::foo* >. 2010-01-13: olly [PHP] Add datetime to the list of PHP predefined classes (patch from David Fletcher in SF#2931042). 2010-01-11: wsfulton Slight change to warning, error and diagnostic reporting. The warning number is no longer shown within brackets. This is to help default parsing of warning messages by other tools, vim on Unix in particular. Example original display using -Fstandard: example.i:20: Warning(401): Nothing known about base class 'B'. Ignored. New display: example.i:20: Warning 401: Nothing known about base class 'B'. Ignored. Also subtle fix to -Fmicrosoft format adding in missing space. Example original display: example.i(20): Warning(401): Nothing known about base class 'Base'. Ignored. New display: example.i(20) : Warning 401: Nothing known about base class 'Base'. Ignored. 2010-01-10: wsfulton Fix a few inconsistencies in reporting of file/line numberings including modifying the overload warnings 509, 512, 516, 474, 475 to now be two line warnings. 2010-01-10: wsfulton Modify -debug-tags output to use standard file name/line reporting so that editors can easily navigate to the appropriate lines. Was typically: . top . include . include (/usr/share/swig/temp/trunk/Lib/swig.swg:312) . top . include . include . include (/usr/share/swig/temp/trunk/Lib/swigwarnings.swg:39) now: /usr/share/swig/temp/trunk/Lib/swig.swg:312: . top . include . include /usr/share/swig/temp/trunk/Lib/swigwarnings.swg:39: . top . include . include . include 2010-01-03: wsfulton Fix missing file/line numbers for typemap warnings and in output from the -debug-tmsearch/-debug-tmused options. 2010-01-03: wsfulton Add typemaps used debugging option (-debug-tmused). When used each line displays the typemap used for each type for which code is being generated including the file and line number related to the type. This is effectively a condensed form of the -debug-tmsearch option. Documented in Typemaps.html. 2009-12-23: wsfulton Fix for %javaexception and directors so that all the appropriate throws clauses are generated. Problem reported by Peter Greenwood. 2009-12-20: wsfulton Add -debug-tmsearch option for debugging the typemap pattern matching rules. Documented in Typemaps.html. 2009-12-12: wsfulton [Octave] Remove the -api option and use the new OCTAVE_API_VERSION_NUMBER macro provided in the octave headers for determining the api version instead. 2009-12-04: olly [Ruby] Improve support for Ruby 1.9 under GCC. Addresses part of SF#2859614. 2009-12-04: olly Fix handling of modulo operator (%) in constant expressions (SF#2818562). 2009-12-04: olly [PHP] "empty" is a reserved word in PHP, so rename empty() method on STL classes to "is_empty()" (previously this was automatically renamed to "c_empty()"). *** POTENTIAL INCOMPATIBILITY *** 2009-12-03: olly [PHP] Add typemaps for long long and unsigned long long, and for pointer to method. 2009-12-02: olly [PHP] Fix warning and rename of reserved class name to be case insensitive. 2009-12-01: wsfulton Revert support for %extend and memberin typemaps added in swig-1.3.39. The memberin typemaps are ignored again for member variables within a %extend block. Documentation inconsistency reported by Torsten Landschoff. 2009-11-29: wsfulton [Java, C#] Fix generated quoting when using %javaconst(1)/%csconst(1) for static const char member variables. %javaconst(1) A; %csconst(1) A; struct X { static const char A = 'A'; }; 2009-11-26: wsfulton [Java, C#] Fix %javaconst(1)/%csconst(1) for static const member variables to use the actual constant value if it is specified, rather than the C++ code to access the member. %javaconst(1) EN; %csconst(1) EN; struct X { static const int EN = 2; }; 2009-11-23: wsfulton C++ nested typedef classes can now be handled too, for example: struct Outer { typedef Foo { } FooTypedef1, FooTypedef2; }; 2009-11-18: wsfulton The wrappers for C nested structs are now generated in the same order as declared in the parsed code. 2009-11-18: wsfulton Fix #491476 - multiple declarations of nested structs, for example: struct Outer { struct { int val; } inner1, inner2, *inner3, inner4[1]; } outer; 2009-11-17: wsfulton Fix parsing of enum declaration and initialization, for example: enum ABC { a, b, c } A = a, *pC = &C, array[3] = {a, b, c}; 2009-11-17: wsfulton Fix parsing of struct declaration and initialization, for example: struct S { int x; } instance = { 10 }; 2009-11-15: wsfulton Fix #1960977 - Syntax error parsing derived nested class declaration and member variable instance. 2009-11-14: wsfulton Fix #2310483 - function pointer typedef within extern "C" block. 2009-11-13: wsfulton Fix usage of nested template classes within templated classes so that compilable code is generated. 2009-11-13: olly [php] Fix place where class prefix (as specified with -prefix) wasn't being used. Patch from gverbruggen in SF#2892647. 2009-11-12: wsfulton Fix usage of nested template classes so that compilable code is generated - the nested template class is now treated like a normal nested classes, that is, as an opaque type unless the nestedworkaround feature is used. 2009-11-12: wsfulton Replace SWIGWARN_PARSE_NESTED_CLASS with SWIGWARN_PARSE_NAMED_NESTED_CLASS and SWIGWARN_PARSE_UNNAMED_NESTED_CLASS for named and unnamed nested classes respectively. Named nested class ignored warnings can now be suppressed by name using %warnfilter, eg: %warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::Inner; but clearly unnamed nested classes cannot and the global suppression is still required, eg: #pragma SWIG nowarn=SWIGWARN_PARSE_UNNAMED_NESTED_CLASS 2009-11-11: wsfulton Added the nestedworkaround feature as a way to use the full functionality of a nested class (C++ mode only). It removes the nested class from SWIG's type information so it is as if SWIG had never parsed the nested class. The documented nested class workarounds using a global fake class stopped working when SWIG treated the nested class as an opaque pointer, and this feature reverts this behaviour. The documentation has been updated with details of how to use and implement it, see the "Nested classes" section in SWIGPlus.html. 2009-11-11: wsfulton There were a number of C++ cases where nested classes/structs/unions were being handled as if C code was being parsed which would oftentimes lead to uncompilable code as an attempt was made to wrap the nested structs like it is documented for C code. Now all nested structs/classes/unions are ignored in C++ mode, as was always documented. However, there is an improvement as usage of nested structs/classes/unions is now always treated as an opaque type by default, resulting in generated code that should always compile. *** POTENTIAL INCOMPATIBILITY *** 2009-11-09: drjoe Fix R for -fcompact and add std_map.i 2009-11-08: wsfulton Fix inconsistency for nested structs/unions/classes. Uncompilable code was being generated when inner struct and union declarations were used as types within the inner struct. The inner struct/union is now treated as a forward declaration making the behaviour the same as an inner class. (C++ code), eg: struct Outer { struct InnerStruct { int x; }; InnerStruct* getInnerStruct(); }; 2009-11-08: wsfulton Ignored nested class/struct warnings now display the name of the ignored class/struct. 2009-11-07: wsfulton Bug #1514681 - Fix nested template classes within a namespace generated uncompilable code and introduced strange side effects to other wrapper code especially code after the nested template class. Note that nested template classes are still ignored. 2009-11-07: wsfulton Add new debug options: -debug-symtabs - Display symbol tables information -debug-symbols - Display target language symbols in the symbol tables -debug-csymbols - Display C symbols in the symbol tables 2009-11-03: wsfulton Fix some usage of unary scope operator (::) denoting global scope, for example: namespace AA { /* ... */ } using namespace ::AA; and bug #1816802 - SwigValueWrapper should be used: struct CC { CC(int); // no default constructor }; ::CC x(); and in template parameter specializations: struct S {}; template struct X { void a() {} }; template <> struct X { void b() {} }; %template(MyTConcrete) X< ::S >; plus probably some other corner case usage of ::. 2009-11-02: olly [Python] Fix potential memory leak in initialisation code for the generated module. 2009-10-23: wsfulton Fix seg fault when using a named nested template instantiation using %template(name) within a class. A warning that these are not supported is now issued plus processing continues as if no name was given. 2009-10-20: wsfulton [Python] Fix std::vector. This would previously compile, but not run correctly. 2009-10-20: wsfulton Fixed previously fairly poor template partial specialization and explicit specialization support. Numerous bugs in this area have been fixed including: - Template argument deduction implemented for template type arguments, eg this now works: template class X {}; template class X {}; %template(X1) X; // Chooses T * specialization and more complex cases with multiple parameters and a mix of template argument deduction and explicitly specialised parameters, eg: template struct TwoParm { void a() {} }; template struct TwoParm { void e() {} }; %template(E) TwoParm; Note that the primary template must now be in scope, like in C++, when an explicit or partial specialization is instantiated with %template. *** POTENTIAL INCOMPATIBILITY *** 2009-09-14: wsfulton [C#] Add %csattributes for adding C# attributes to enum values, see docs for example. 2009-09-11: wsfulton Fix memmove regression in cdata.i as reported by Adriaan Renting. 2009-09-07: wsfulton Fix constant expressions containing <= or >=. 2009-09-02: wsfulton The following operators in constant expressions now result in type bool for C++ wrappers and remain as type int for C wrappers, as per each standard: && || == != < > <= >= (Actually the last 4 are still broken). For example: #define A 10 #define B 10 #define A_EQ_B A == B // now wrapped as type bool for C++ #define A_AND_B A && B // now wrapped as type bool for C++ 2009-09-02: wsfulton Fix #2845746. true and false are now recognised keywords (only when wrapping C++). Constants such as the following are now wrapped (as type bool): #define FOO true #define BAR FOO && false Version 1.3.40 (18 August 2009) =============================== 2009-08-17: olly [Perl] Add "#undef do_exec" to our clean up of Perl global namespace pollution. 2009-08-17: olly [PHP] Fix to wrap a resource returned by __get() in a PHP object (SF#2549217). 2009-08-17: wsfulton Fix #2797485 After doing a 'make clean', install fails if yodl2man or yodl2html is not available. 2009-08-16: wsfulton [Octave] Caught exceptions display the type of the C++ exception instead of the generic "c++-side threw an exception" message. 2009-08-16: wsfulton [Java] When %catches is used, fix so that any classes specified in the "throws" attribute of the "throws" typemap are generated into the Java method's throws clause. 2009-08-16: wsfulton [C#] Fix exception handling when %catches is used, reported by Juan Manuel Alvarez. 2009-08-15: wsfulton Fix %template seg fault on some cases of overloading the templated method. Bug reported by Jan Kupec. 2009-08-15: wsfulton [Ruby] Add numerous missing wrapped methods for std::vector specialization as reported by Youssef Jones. 2009-08-14: wsfulton [Perl] Add SWIG_ConvertPtrAndOwn() method into the runtime for smart pointer memory ownership control. shared_ptr support still to be added. Patch from David Fletcher. 2009-08-14: olly [PHP] PHP5 now wraps static member variables as documented. 2009-08-14: olly [PHP] Update the PHP "class" example to work with PHP5 and use modern wrapping features. 2009-08-13: wsfulton [PHP] std::vector wrappers overhaul. They no longer require the specialize_std_vector() macro. Added wrappers for capacity() and reserve(). 2009-08-13: wsfulton [PHP] Add const reference typemaps. const reference primitive types are now passed by value rather than pointer like the other target languages. Fixes SF#2524029. 2009-08-08: wsfulton [Python] More user friendly AttributeError is raised when there are no constructors generated for the proxy class in the event that the class is abstract - the error message is now "No constructor defined - class is abstract" whereas if there are no public constructors for any other reason and the class is not abstract, the message remains "No constructor defined". [tcl] Similarly for tcl when using -itcl. 2009-08-04: olly [PHP] Fix generated code to work with PHP 5.3. 2009-08-04: vmiklos [PHP] Various mathematical functions (which would conflict with the built-in PHP ones) are now automatically handled by adding a 'c_' prefix. 2009-08-03: wsfulton [C#] The std::vector implementation is improved and now uses $typemap such that the proxy class for T no longer has to be specified in some macros for correct C# compilation; the following macros are deprecated, where CSTYPE was the C# type for the C++ class CTYPE: SWIG_STD_VECTOR_SPECIALIZE_MINIMUM(CSTYPE, CTYPE) usage should be removed altogether SWIG_STD_VECTOR_SPECIALIZE(CSTYPE, CTYPE) should be replaced with: SWIG_STD_VECTOR_ENHANCED(CTYPE) Some more details in csharp/std_vector.i *** POTENTIAL INCOMPATIBILITY *** 2009-07-31: olly [Python] Fix indentation so that we give a useful error if the module can't be loaded. Patch from Gaetan Lehmann in SF#2829853. 2009-07-29: wsfulton Add $typemap(method, typelist) special variable macro. This allows the contents of a typemap to be inserted within another typemap. Fully documented in Typemaps.html. 2009-07-29: vmiklos [PHP] Static member variables are now prefixed with the class name. This allows static member variables with the same name in different classes. 2009-07-29: olly [Python] Add missing locks to std::map wrappers. Patch from Paul Hampson in SF#2813836. 2009-07-29: olly [PHP] Fix memory leak in PHP OUTPUT typemaps. Reported by Hitoshi Amano in SF#2826322. 2009-07-29: olly [PHP] Fix memory leak in PHP resource destructor for classes without a destructor and non-class types. Patch from Hitoshi Amano in SF#2825303. 2009-07-28: olly [PHP] Update warnings about clashes between identifiers and PHP keywords and automatic renaming to work with the PHP5 class wrappers. Fixes SF#1613679. 2009-07-28: vmiklos [PHP] If a member function is not public but it has a base which is public, then now a warning is issued and the member function will be public, as PHP requires this. 2009-07-21: vmiklos [PHP] Director support added. 2009-07-15: olly [Perl] Don't specify Perl prototype "()" for a constructor with a different name to the class, as such constructors can still take parameters. 2009-07-12: xavier98 [Octave] Add support for Octave 3.2 API 2009-07-05: olly [PHP] Update the list of PHP keywords - "cfunction" is no longer a keyword in PHP5 and PHP 5.3 added "goto", "namespace", "__DIR__", and "__NAMESPACE__". 2009-07-03: olly [Tcl] To complement USE_TCL_STUBS, add support for USE_TK_STUBS and SWIG_TCL_STUBS_VERSION. Document all three in the Tcl chapter of the manual. Based on patch from SF#2810380 by Christian Gollwitzer. 2009-07-02: vmiklos [PHP] Added factory.i for PHP, see the li_factory testcase for more info on how to use it. 2009-07-02: wsfulton Fix -Wallkw option as reported by Solomon Gibbs. 2009-07-02: wsfulton Fix syntax error when a nested struct contains a comment containing a * followed eventually by a /. Regression from 1.3.37, reported by Solomon Gibbs. 2009-07-01: vmiklos [PHP] Unknown properties are no longer ignored in proxy classes. 2009-07-01: vmiklos [PHP] Fixed %newobject behaviour, previously any method marked with %newobject was handled as a constructor. 2009-06-30: olly [Ruby] Undefine close and connect macros defined by Ruby API headers as we don't need them and they can clash with C++ methods being wrapped. Patch from Vit Ondruch in SF#2814430. 2009-06-26: olly [Ruby] Fix to handle FIXNUM values greater than MAXINT passed for a double parameter. 2009-06-24: wsfulton Fix wrapping methods with default arguments and the compactdefaultargs feature where a class is passed by value and is assigned a default value. The SwigValueWrapper template workaround for a missing default constructor is no longer used as the code generated does not call the default constructor. 2009-06-16: wsfulton [Java,C#] Fix enum marshalling when %ignore is used on one of the enum items. Incorrect enum values were being passed to the C++ layer or compilation errors resulted. 2009-06-02: talby [Perl] Resolved reference.i overload support problem identified by John Potowsky. 2009-05-26: wsfulton [C#] Improved std::map wrappers based on patch from Yuval Baror. The C# proxy now implements System.Collections.Generic.IDictionary<>. These std:map wrappers have a non-backwards compatible overhaul to make them like a .NET IDictionary. Some method names have changed as following: set -> setitem (use this[] property now) get -> getitem (use this[] property now) has_key -> ContainsKey del -> Remove clear -> Clear The following macros used for std::map wrappers are deprecated and will no longer work: specialize_std_map_on_key specialize_std_map_on_value specialize_std_map_on_both *** POTENTIAL INCOMPATIBILITY *** 2009-05-20: vmiklos [PHP] Add the 'thisown' member to classes. The usage of it is the same as the Python thisown one: it's 1 by default and you can set it to 0 if you want to prevent freeing it. (For example to prevent a double free.) 2009-05-14: bhy [Python] Fix the wrong pointer value returned by SwigPyObject_repr(). 2009-05-13: mutandiz (Mikel Bancroft) [allegrocl] Minor tweak when wrapping in -nocwrap mode. 2009-05-11: wsfulton [C#] Improved std::vector wrappers on the C# proxy side from Yuval Baror. These implement IList<> instead of IEnumerable<> where possible. 2009-04-29: wsfulton [Java, C#] Add the 'notderived' attribute to the javabase and csbase typemaps. When this attribute is set, the typemap will not apply to classes that are derived from a C++ base class, eg %typemap(csbase, notderived="1") SWIGTYPE "CommonBase" 2009-04-29: olly [Python] Don't attempt to acquire the GIL in situations where we know that it will already be locked. This avoids some dead-locks with mod_python (due to mod_python bugs which are apparently unlikely to ever be fixed), and results in smaller wrappers which run a little faster (in tests with Xapian on x86-64 Ubuntu 9.04, the stripped wrapper library was 11% smaller and ran 2.7% faster). 2009-04-21: wsfulton [C#] Fix #2753469 - bool &OUTPUT and bool *OUTPUT typemaps initialisation. 2009-04-09: wsfulton Fix #2746858 - C macro expression using floating point numbers 2009-03-30: olly [PHP] The default out typemap for char[ANY] now returns the string up to a zero byte, or the end of the array if there is no zero byte. This is the same as Python does, and seems more generally useful than the previous behaviour of returning the whole contents of the array including any zero bytes. If you want the old behaviour, you can provide your own typemap to do this: %typemap(out) char [ANY] %{ RETVAL_STRINGL($1, $1_dim0, 1); %} Version 1.3.39 (21 March 2009) ============================== 2009-03-19: bhy [Python] Fix the memory leak related to Python 3 unicode and C char* conversion, which can be shown in the following example before this fix: from li_cstring import * i=0 while True: i += 1 n = str(i)*10 test3(n) This fix affected SWIG_AsCharPtrAndSize() so you cannot call this function with a null alloc and non-null cptr argument in Python 3, otherwise a runtime error will be raised. 2009-03-18: wsfulton [C#] std::vector wrapper improvements for .NET 2 and also providing the necessary machinery to use the std::vector wrappers with more advanced features such as LINQ - the C# proxy class now derives from IEnumerable<>. The default is now to generate code requiring .NET 2 as a minimum, although the C# code can be compiled for .NET 1 by defining the SWIG_DOTNET_1 C# preprocessor constant. See the std_vector.i file for more details. *** POTENTIAL INCOMPATIBILITY *** 2009-03-12: wsfulton [Ruby] Fix #2676738 SWIG generated symbol name clashes. 2009-03-01: bhy [Python] Some fixes for Python 3.0.1 and higher support. In 3.0.1, the C API function PyObject_Compare is removed, so PyObject_RichCompareBool is used for replacement. Struct initilization of SwigPyObject and SwigPyObject_as_number changed to reflect the drop of tp_compare and nb_long. 2009-03-01: bhy [Python] Fix SF#2583160. Now the importer in Python shadow wrapper take care of the case that module already imported at other place. 2009-02-28: bhy [Python] Fix SF#2637352. Move struct declaration of SWIG_module in pyinit.swg before the method calls, since some C compiler don't allow declaration in middle of function body. 2009-02-21: wsfulton [Allegrocl] Fix seg fault wrapping some constant variable (%constant) types. 2009-02-20: wsfulton [CFFI] Fix seg faults when for %extend and using statements. 2009-02-20: wsfulton Fix SF #2605955: -co option which broke in 1.3.37. 2009-02-20: wsfulton New %insert("begin") section added. Also can be used as %begin. This is a new code section reserved entirely for users and the code within the section is generated at the top of the C/C++ wrapper file and so provides a means to put custom code into the wrapper file before anything else that SWIG generates. 2009-02-17: wsfulton 'make clean-test-suite' will now run clean on ALL languages. Previously it only ran the correctly configured languages. This way it is now possible to clean up properly after running 'make partialcheck-test-suite'. 2009-02-14: wsfulton Extend attribute library support for structs/classes and the accessor functions use pass/return by value semantics. Two new macros are available and usage is identical to %attribute. These are %attributeval for structs/classes and %attributestring for string classes, like std::string. See attribute.swg for more details. 2009-02-13: wsfulton Add support for %extend and memberin typemaps. Previously the memberin typemaps were ignored for member variables within a %extend block. 2009-02-12: wsfulton Remove unnecessary temporary variable when wrapping return values that are references. Example of generated code for wrapping: struct XYZ { std::string& refReturn(); }; used to be: std::string *result = 0 ; ... { std::string &_result_ref = (arg1)->refReturn(); result = (std::string *) &_result_ref; } Now it is: std::string *result = 0 ; ... result = (std::string *) &(arg1)->refReturn(); 2009-02-08: bhy Change the SIZE mapped by %pybuffer_mutable_binary and %pybuffer_binary in pybuffer.i from the length of the buffer to the number of items in the buffer. 2009-02-08: wsfulton Fix %feature not working for conversion operators, reported by Matt Sprague, for example: %feature("cs:methodmodifiers") operator bool "protected"; 2009-02-07: wsfulton [MzScheme] Apply #2081967 configure changes for examples to build with recent PLT versions. Also fixes Makefile errors building SWIG executable when mzscheme package is installed (version 3.72 approx and later). 2009-02-04: talby [Perl] Fix SF#2564192 reported by David Kolovratnk. SWIG_AsCharPtrAndSize() now handles "get" magic. Version 1.3.38 (31 January 2009) ================================ 2009-01-31: bhy [Python] Fix SF#2552488 reported by Gaetan Lehmann. Now %pythonprepend and %pythonappend have correct indentation. 2009-01-31: bhy [Python] Fix SF#2552048 reported by Gaetan Lehmann. The parameter list of static member function in generated proxy code should not have the 'self' parameter. 2009-01-29: wsfulton Fix regression introduced in 1.3.37 where the default output directory for target language specific files (in the absence of -outdir) was no longer the same directory as the generated c/c++ file. 2009-01-28: wsfulton [Java, C#] Fix proxy class not being used when the global scope operator was used for parameters passed by value. Reported by David Piepgrass. 2009-01-15: wsfulton [Perl] Fix seg fault when running with -v option, reported by John Ky. Version 1.3.37 (13 January 2009) ================================ 2009-01-13: mgossage [Lua] Added contract support for requiring that unsigned numbers are >=0 Rewrote much of Examples/Lua/embed3. Added a lot to the Lua documentation. 2009-01-13: wsfulton Fix compilation error when using directors on protected virtual overloaded methods reported by Sam Hendley. 2009-01-12: drjoe [R] Fixed handling of integer arrays 2009-01-10: drjoe [R] Fix integer handling in r to deal correctly with signed and unsigned issues 2009-01-10: wsfulton Patch #1992756 from Colin McDonald - %contract not working for classes in namespace 2009-01-05: olly Mark SWIGPERL5, SWIGPHP5, and SWIGTCL8 as deprecated in the source code and remove documentation of them. 2008-12-30: wsfulton Bug #2430756. All the languages now define a macro in the generated C/C++ wrapper file indicating which language is being wrapped. The macro name is the same as those defined when SWIG is run, eg SWIGJAVA, SWIGOCTAVE, SWIGCSHARP etc and are listed in the "Conditional Compilation" section in the documentation. 2008-12-23: wsfulton [Java] Fix #2153773 - %nojavaexception was clearing the exception feature instead of disabling it. Clearing checked Java exceptions also didn't work. The new %clearjavaexception can be used for clearing the exception feature. 2008-12-22: wsfulton Fix #2432801 - Make SwigValueWrapper exception safe for when copy constructors throw exceptions. 2008-12-21: wsfulton Apply patch #2440046 which fixes possible seg faults for member and global variable char arrays when the strings are larger than the string array size. 2008-12-20: wsfulton The ccache compiler cache has been adapted to work with SWIG and named ccache-swig. It now works with C/C++ compilers as well as SWIG and can result in impressive speedups when used to recompile unchanged code with either a C/C++ compiler or SWIG. Documentation is in CCache.html or the installed ccache-swig man page. 2008-12-12: wsfulton Apply patch from Kalyanov Dmitry which fixes parsing of nested structs containing comments. 2008-12-12: wsfulton Fix error message in some nested struct and %inline parsing error situations such as unterminated strings and comments. 2008-12-07: olly [PHP] Fix warnings when compiling generated wrapper with GCC 4.3. 2008-12-06: wsfulton [PHP] Deprecate %pragma(php4). Please use %pragma(php) instead. The following two warnings have been renamed: WARN_PHP4_MULTIPLE_INHERITANCE -> WARN_PHP_MULTIPLE_INHERITANCE WARN_PHP4_UNKNOWN_PRAGMA -> WARN_PHP_UNKNOWN_PRAGMA *** POTENTIAL INCOMPATIBILITY *** 2008-12-04: bhy [Python] Applied patch SF#2158938: all the SWIG symbol names started with Py are changed, since they are inappropriate and discouraged in Python documentation (from http://www.python.org/doc/2.5.2/api/includes.html): "All user visible names defined by Python.h (except those defined by the included standard headers) have one of the prefixes "Py" or "_Py". Names beginning with "_Py" are for internal use by the Python implementation and should not be used by extension writers. Structure member names do not have a reserved prefix. Important: user code should never define names that begin with "Py" or "_Py". This confuses the reader, and jeopardizes the portability of the user code to future Python versions, which may define additional names beginning with one of these prefixes." Here is a brief list of what changed: PySwig* -> SwigPy* PyObject_ptr -> SwigPtr_PyObject PyObject_var -> SwigVar_PyObject PySequence_Base, PySequence_Cont, PySequence_Ref -> SwigPySequence_Base, SwigPySequence_Cont, SwigPySequence_Ref PyMap* -> SwigPyMap* We provided a pyname_compat.i for backward compatibility. Users whose code having these symbols and do not want to change it could simply include this file at front of your code. A better solution is to run the converting tool on your code, which has been put in SWIG's SVN trunk (Tools/pyname_patch.py) and you can download it here: https://swig.svn.sourceforge.net/svnroot/swig/trunk/Tools/pyname_patch.py *** POTENTIAL INCOMPATIBILITY *** 2008-12-02: wsfulton [Python] Apply patch #2143727 from Serge Monkewitz to fix importing base classes when the package option is specified in %module and that module is %import'ed. 2008-11-28: wsfulton [UTL] Fix #2080497. Some incorrect acceptance of types in the STL, eg a double * element passed into a vector constructor would be accepted, but the ensuing behaviour was undefined. Now the type conversion correctly raises an exception. 2008-11-24: wsfulton Add -outcurrentdir option. This sets the default output directory to the current directory instead of the path specified by the input file. This option enables behaviour similar to c/c++ compilers. Note that this controls the output directory, but only in the absence of the -o and/or -outdir options. 2008-11-23: wsfulton [ruby] Apply patch #2263850 to fix ruby/file.i ... rubyio.h filename change in ruby 1.9. 2008-11-23: wsfulton Apply patch #2319790 from Johan Hake to fix shared_ptr usage in std::tr1 namespace. 2008-11-21: wsfulton The use of the include path to find the input file is now deprecated. This makes the behaviour of SWIG the same as C/C++ compilers in preparation for use with ccache. 2008-11-16: wsfulton Fix -nopreprocess option to: - correctly report file names in warning and error messages. - use the original input filename that created the preprocessed output when determining the C++ wrapper file name (in the absence of -o). Previously the name of the input file containing the preprocessed output was used. 2008-11-11: wsfulton [Java] Add patch #2152691 from MATSUURA Takanori which fixes compiles using the Intel compiler 2008-11-01: wsfulton Add patch #2128249 from Anatoly Techtonik which corrects the C/C++ proxy class being reported for Python docstrings when %rename is used. 2008-11-01: wsfulton Add the strip encoder patch from Anatoly Techtonik #2130016. This enables an easy way to rename symbols by stripping a commonly used prefix in all the function/struct names. It works in the same way as the other encoders, such as title, lower, command etc outlined in CHANGES file dated 12/30/2005. Example below will rename wxAnotherWidget to AnotherWidget and wxDoSomething to DoSomething: %rename("%(strip:[wx])s") ""; struct wxAnotherWidget { void wxDoSomething(); }; 2008-09-26: mutandiz [allegrocl] Lots of test-suite work. - Fix ordering of wrapper output and %{ %} header output. - Fix declarations of local vars in C wrappers. - Fix declaration of defined constants in C wrappers. - Fix declaration of EnumValues in C wrappers. - add some const typemaps to allegrocl.swg - add rename for operator bool() overloads. 2008-09-25: olly [PHP5] Fill in typemaps for SWIGTYPE and void * (SF#2095186). 2008-09-22: mutandiz (Mikel Bancroft) [allegrocl] - Support wrapping of types whose definitions are not seen by SWIG. They are treated as forward-referenced classes and if a definition is not seen are treated as (* :void). - Don't wrap the contents of unnamed namespaces. - More code cleanup. Removed some extraneous warnings. - start work on having the allegrocl mod pass the cpp test-suite. 2008-09-19: olly [PHP5] Add typemaps for long long and unsigned long long. 2008-09-18: wsfulton [C#] Added C# array typemaps provided by Antti Karanta. The arrays provide a way to use MarshalAs(UnmanagedType.LPArray) and pinning the array using 'fixed'. See arrays_csharp.i library file for details. 2008-09-18: wsfulton Document the optional module attribute in the %import directive, see Modules.html. Add a warning for Python wrappers when the module name for an imported base class is missing, requiring the module attribute to be added to %import, eg %import(module="FooModule") foo.h 2008-09-18: olly [PHP5] Change the default input typemap for char * to turn PHP Null into C NULL (previously it was converted to an empty string). The new behaviour is consistent with how the corresponding output typemap works (SF#2025719). If you want to keep the old behaviour, add the following typemap to your interface file (PHP's convert_to_string_ex() function does the converting from PHP Null to an empty string): %typemap(in) char * { convert_to_string_ex($input); $1 = Z_STRVAL_PP($input); } 2008-09-18: olly [PHP5] Fix extra code added to proxy class constructors in the case where the only constructor takes no arguments. 2008-09-18: olly [PHP5] Fix wrapping of a renamed enumerated value of an enum class member (SF#2095273). 2008-09-17: mutandiz (Mikel Bancroft) [allegrocl] - Fix how forward reference typedefs are handled, so as not to conflict with other legit typedefs. - Don't (for now) perform an ffitype typemap lookup when trying to when calling compose_foreign_type(). This is actually a useful thing to do in certain cases, the test cases for which I can't currently locate :/. It's breaking some wrapping behavior that is more commonly seen, however. I'll readd in a more appropriate way when I can recreate the needed test case, or a user complains (which means they probably have a test case). - document the -isolate command-line arg in the 'swig -help' output. It was in the html docs, but not there. - small amount of code cleanup, removed some unused code. - some minor aesthetic changes. 2008-09-12: bhy [Python] Python 3.0 support branch merged into SWIG trunk. Thanks to Google Summer of Code 2008 for supporting this project! By default SWIG will generate interface files compatible with both Python 2.x and 3.0. And there's also some Python 3 new features that can be enabled by passing a "-py3" command line option to SWIG. These features are: - Function annotation support Also, the parameter list of proxy function will be generated, even without the "-py3" option. However, the parameter list will fallback to *args if the function (or method) is overloaded. - Buffer interface support - Abstract base class support For details of Python 3 support and these features, please see the "Python 3 Support" section in the "SWIG and Python" chapter of the SWIG documentation. The "-apply" command line option and support of generating codes using apply() is removed. Since this is only required by very old Python. This merge also patched SWIG's parser to solve a bug. By this patch, SWIG features able to be correctly applied on C++ conversion operator, such like this: %feature("shadow") *::operator bool %{ ... %} 2008-09-02: richardb [Python] Commit patch #2089149: Director exception handling mangles returned exception. Exceptions raised by Python code in directors are now passed through to the caller without change. Also, remove the ": " prefix which used to be added to other director exceptions (eg, those due to incorrect return types). 2008-09-02: wsfulton [Python] Commit patch #1988296 GCItem multiple module linking issue when using directors. 2008-09-02: wsfulton [C#] Support for 'using' and 'fixed' blocks in the 'csin' typemap is now possible through the use of the pre attribute and the new terminator attribute, eg %typemap(csin, pre=" using (CDate temp$csinput = new CDate($csinput)) {", terminator=" } // terminate temp$csinput using block", ) const CDate & "$csclassname.getCPtr(temp$csinput)" See CSharp.html for more info. 2008-09-01: wsfulton [CFFI] Commit patch #2079381 submitted by Boris Smilga - constant exprs put into no-eval context in DEFCENUM 2008-08-02: wuzzeb [Chicken,Allegro] Commit Patch 2019314 Fixes a build error in chicken, and several build errors and other errors in Allegro CL 2008-07-19: wsfulton Fix building of Tcl examples/test-suite on Mac OS X reported by Gideon Simpson. 2008-07-17: wsfulton Fix SF #2019156 Configuring with --without-octave or --without-alllang did not disable octave. 2008-07-14: wsfulton [Java, C#] Fix director typemaps for pointers so that NULL pointers are correctly marshalled to C#/Java null in director methods. 2008-07-04: olly [PHP] For std_vector.i and std_map.i, rename empty() to is_empty() since "empty" is a PHP reserved word. Based on patch from Mark Klein in SF#1943417. 2008-07-04: olly [PHP] The deprecated command line option "-make" has been removed. Searches on Google codesearch suggest that nobody is using it now anyway. 2008-07-04: olly [PHP] The SWIG cdata.i library module is now supported. 2008-07-03: olly [PHP] The deprecated command line option "-phpfull" has been removed. We recommend building your extension as a dynamically loadable module. 2008-07-02: olly [PHP4] Support for PHP4 has been removed. The PHP developers are no longer making new PHP4 releases, and won't even be providing patches for critical security issues after 2008-08-08. 2008-07-02: olly [Python] Import the C extension differently for Python 2.6 and later so that an implicit relative import doesn't produce a deprecation warning for 2.6 and a failure for 2.7 and later. Patch from Richard Boulton in SF#2008229, plus follow-up patches from Richard and Haoyu Bai. Version 1.3.36 (24 June 2008) ============================= 06/24/2008: wsfulton Remove deprecated -c commandline option (runtime library generation). 06/24/2008: olly [PHP] Fix assertion failure when handling %typemap(in,numinputs=0) (testcase ignore_parameter). 06/24/2008: olly [PHP] Fix segfault when wrapping a non-class function marked with %newobject (testcase char_strings). 06/22/2008: wsfulton [Java] Add a way to use AttachCurrentThreadAsDaemon instead of AttachCurrentThread in director code. Define the SWIG_JAVA_ATTACH_CURRENT_THREAD_AS_DAEMON macro, see Lib/java/director.swg. 06/21/2008: wsfulton [Ruby] Fix crashing in the STL wrappers (reject! and delete_if methods) 06/19/2008: wsfulton [Java, C#] C# and Java keywords will be renamed instead of just issuing a warning and then generating uncompilable code. Warning 314 gives the new name when a keyword is found. 06/19/2008: wsfulton [R] Keyword handling added. R Keywords will be renamed as necessary. Warning 314 gives the new name when a keyword is found. 06/17/2008: mgossage [Lua] Added missing support for bool& and bool*. Added runtest for li_typemaps testcase. (Bug #1938142) 06/07/2008: bhy Added test case keyword_rename, then made the keyword renaming works properly by fixing Swig_name_make() for a incomplete condition checking. 06/02/2008: wsfulton [Java, C#] Fix enum wrappers when using -noproxy. 05/30/2008: bhy Added std::wstring into Lib/typemaps/primtypes.swg, since it is also a primitive type in SWIG - fixed SF #1976978. 05/29/2008: wsfulton [Java, C#] Fix variable wrappers when using -noproxy. 05/29/2008: bhy [Python] Fixed a typo of %#ifdef in Lib/python/pycontainer.swg, which is related to -extranative SWIG option - SF #1971977. 05/20/2008: wsfulton New partialcheck makefile targets for partial testing of the test-suite. These just invoke SWIG, ie no compilation and no runtime testing. It can be faster when developing by just doing a directory diff of the files SWIG generates against those from a previous run. Example usage from the top level directory: make partialcheck-test-suite make partialcheck-java-test-suite This change also encompasses more flexibility in running the test-suite, eg it is possible to prefix the command line which runs any target language test with a tool. See the RUNTOOL, COMPILETOOL and SWIGTOOL targets in the common.mk file and makefiles in the test-suite directory. For example it is possible to run the runtime tests through valgrind using: make check RUNTOOL="valgrind --leak-check=full" or invoke SWIG under valgrind using: make check SWIGTOOL="valgrind --tool=memcheck" 05/19/2008: drjoe [R] Fixed define that was breaking pre-2.7. Checked in patch from Soren Sonnenburg that creates strings in version independent way 05/15/2008: wsfulton [Java] Fix variable name clash in directors - SF #1963316 reported by Tristan. 05/14/2008: wsfulton Add an optimisation for functions that return objects by value, reducing the number of copies of the object that are made. Implemented using an optional attribute in the "out" typemap called "optimal". Details in Typemaps.html. 05/11/2008: olly [PHP] Check for %feature("notabstract") when generating PHP5 class wrapper. 05/11/2008: wsfulton Fix SF #1943608 - $self substitution in %contract, patch submitted by Toon Verstraelen. 05/09/2008: olly [PHP] Fix char * typemaps to work when applied to signed char * and unsigned char * (uncovered by testcase apply_strings). 05/09/2008: wsfulton Fix wrapping of char * member variables when using allprotected mode. Bug reported by Warren Wang. 05/09/2008: olly [PHP] Fix bad PHP code generated when wrapping an enum in a namespace (uncovered by testcase arrays_scope). 05/09/2008: olly [PHP] SWIG now runs the PHP testsuite using PHP5, not PHP4. PHP4 is essentially obsolete now, so we care much more about solid PHP5 support. 05/07/2008: wsfulton STL fixes when using %import rather than %include and the Solaris Workshop compiler and the Roguewave STL. 05/07/2008: wsfulton Fix wrapping of overloaded protected methods when using allprotected mode. Bug reported by Warren Wang. 05/03/2008: wsfulton Commit patch #1956607 to add -MT support from Richard Boulton. This patch mirrors the gcc -MT option which allows one to change the default Makefile target being generated when generating makefiles with the -M family of options. For example: $ swig -java -MM -MT overriddenname -c++ example.i overriddenname: \ example.i \ example.h 04/30/2008: mgossage [Lua] Removed generation of _wrap_delete_XXXXX (wrappered destructor) which was unused and causing warning with g++ -Wall. Removed other unused warning in typemaps.i and other places. Added Examples/lua/embed3, and run tests a few test cases. 04/24/2008: olly [Python] Fix generated code for IBM's C++ compiler on AIX (patch from Goeran Uddeborg in SF#1928048). 04/24/2008: olly Rename BSIZE in Examples/test-suite/arrays_scope.i to BBSIZE to avoid a clash with BSIZE defined by headers on AIX with Perl (reported in SF#1928048). 04/20/2008: wsfulton Add the ability to wrap all protected members when using directors. Previously only the virtual methods were available to the target language. Now all protected members, (static and non-static variables, non-virtual methods and static methods) are wrapped when using the allprotected mode. The allprotected mode is turned on in the module declaration: %module(directors="1", allprotected="1") modulename Version 1.3.35 (7 April 2008) ============================= 04/07/2008: wsfulton [Lua] Add missing pointer reference typemaps 04/06/2008: wsfulton Fix stack overflow when using typemap warning suppression, eg %warnfilter(SWIGWARN_TYPEMAP_CHARLEAK_MSG) 04/05/2008: wsfulton [Python] Fix shared_ptr typemaps so that %pythonnondynamic can be used. Also corrects display of the proxy class type. Reported by Robert Lupton. 04/04/2008: olly [Python] Add %newobject reference to python memory management subsection of manual (patch from mdbeachy in SF#1894610). 03/27/2008: wsfulton [Python] Fix shared_ptr typemaps where the pointer type is a templated type with with more than one parameter. Reported by Robert Lupton. 03/27/2008: mgossage [Lua] Added a typemap DISOWN for SWIGTYPE* and SWIGTYPE[], and support for %delobject feature. Added Examples/lua/owner which demonstrates the use of the memory management. 03/26/2008: wsfulton [Java] Apply patch #1844301 from Monty Taylor to suppress enum constructor unused warnings. 03/26/2008: wsfulton [Python] Apply patch #1924524 from Casey Raymondson which ensures the "No constructor defined" message is displayed when attempting to call a constructor on a class that doesn't have a constructor wrapper, eg if the C++ class is abstract. 03/26/2008: wsfulton [Python] Apply patch #1925702 from Casey Raymondson which removes warning 512 for std::vector wrappers. 03/26/2008: olly [Python] Apply GCC 4.3 warnings patch from Philipp Thomas (SF#1925122). 03/21/2008: wsfulton [Python] Thread safety patch for STL iterators from Abhinandan Jain. 03/17/2008: mgossage [Lua] Added %luacode feature to add source code into wrappers. Updated documentation to document this. Added Examples/lua/arrays to show its use (and typemaps) 03/17/2008: olly Fix nonportable sed usage which failed on Mac OS X (and probably other platforms). Fixes SF#1903612. 03/17/2008: olly Fix memory leak in SWIG's parser (based on patch from Russell Bryant in SF#1914023). 03/12/2008: wsfulton Fix bug #1878285 - unnecessary cast for C struct creation wrappers. 03/12/2008: wsfulton [Python] Remove debugging info when using shared_ptr support 03/06/2008: mgossage [Lua] Updated documentation for Lua exceptions. Added Examples/lua/exception and Examples/lua/embed2. Small updates to the typemaps. 03/04/2008: wsfulton [Java, C#] Add char *& typemaps. 03/04/2008: wsfulton Fix occasional seg fault when attempting to report overloaded methods as being ignored. 02/29/2008: wsfulton [Perl] Fix #1904537 Swig causes a Perl warning "x used only once" in Perl 5.10 reported by Ari Jolma 02/29/2008: wsfulton [Python] Add shared_ptr varin/varout typemaps for wrapping global variables. 02/25/2008: wsfulton Fix $wrapname to work in %exception (fixes some wrap:name assertions) Version 1.3.34 (27 February 2008) ================================= 02/13/2008: wsfulton [R] Fix wrapping of global function pointer variables. 02/13/2008: wsfulton Add new special variables for use within %exception: $wrapname - language specific wrapper name $overname - if a method is overloaded this contains the extra mangling used on the overloaded method $decl - the fully qualified C/C++ declaration of the method being wrapped without the return type $fulldecl - the fully qualified C/C++ declaration of the method being wrapped including the return type 02/12/2008: drjoe [R] Now setting S4 flag in SWIG created objects. This fixes R-SWIG for 2.6 and warning for 2.6 failure has been removed. 02/11/2008: mgossage [Lua] Added a patch by Torsten Landschoff to fix the unary minus issue Ran 'astyle --style=kr -2' across lua.cxx to neaten it up 02/10/2008: wsfulton Bump SWIG_RUNTIME_VERSION to 4. This is because of the recently introduced API change in the conversion functions, ie change in definition of swig_converter_func. Anyone calling SWIG_TypeCast must pass in a valid value for the new additional (third) parameter and then handle the newly created memory if the returned value is set to SWIG_CAST_NEW_MEMORY else a memory leak will ensue. 02/09/2008: wsfulton [Python] Experimental shared_ptr typemaps added. Usage is the same as the recently added Java and C# shared_ptr typemaps. Two macros are available, although these may well change in a future version: For base classes or classes not in an inheritance chain: SWIG_SHARED_PTR(PROXYCLASS, TYPE) For derived classes: SWIG_SHARED_PTR_DERIVED(PROXYCLASS, BASECLASSTYPE, TYPE) The PROXYCLASS is the name of the proxy class, but is only required for Java/C#. Example usage: %include "boost_shared_ptr.i" SWIG_SHARED_PTR(Klass, Space::Klass) SWIG_SHARED_PTR_DERIVED(KlassDerived, Space::Klass, Space::KlassDerived) namespace Space { struct Klass { ... }; struct KlassDerived : Klass { ... }; } Further details to follow in future documentation, but the following features should be noted: - Not restricted to boost::shared_ptr, eg std::tr1::shared_ptr can also be used. - Available typemap groups: (a) Typemaps for shared_ptr passed by value, reference, pointer and pointer reference. - (b) Typemaps for passing by raw value, raw pointer, raw reference, raw pointer reference. - The code being wrapped does not even have to use shared_ptr, SWIG can use shared_ptr as the underlying storage mechanism instead of a raw pointer due to the typemaps in group (b) above. - No array support as shared_ptr does not support arrays. - This works quite differently to the usual SWIG smart pointer support when operator-> is parsed by SWIG: - An additional smart pointer class is not generated reducing code bloat in the wrappers. - Using smart pointers and raw pointers can be mixed seamlessly. - Missing constructors for the smart pointers is no longer a problem and so separate factory type functions do not have to be written and wrapped. - The implicit C++ shared_ptr< derived class > to shared_ptr< base class > cast also works in the target language. This negates the necessity to write an explicit helper cast function providing the upcast which would need calling prior to passing a derived class to a method taking a shared_ptr to a base class. 02/09/2008: wsfulton [Python] Add support for overriding the class registration function via a new "smartptr" feature. This is a very low level of customisation most users would never need to know. The feature will typically be used for intrusive smart pointers along with additional typemaps. Example usage of the feature: %feature("smartptr", noblock=1) Foo { boost::shared_ptr< Foo > } class Foo {}; The generated Foo_swigregister function will then register boost::shared < Foo > (SWIGTYPE_p_boost__shared_ptrTFoo_t instead of SWIGTYPE_p_Foo) as the underlying type for instantiations of Foo. 02/09/2008: wsfulton Features now supports the optional 'noblock' attribute for all usage of %feature. When specified, the { } braces are removed from the feature code. This is identical in behaviour to usage of 'noblock' in typemaps and is used when the preprocessor is required to operate on the code in the feature and the enclosing { } braces are not required. Example: #define FOO foo %feature("smartptr", noblock="1") { FOO::bar } The preprocessor then reduces this as if this had been used instead: %feature("smartptr") "foo::bar" 02/01/2008: olly [Python] Fix format string bug (SF#1882220). 01/31/2008: wsfulton Additions to the %types directive. Now the conversion / casting code can be overridden to some custom code in the %types directive, like so: %types(fromtype = totype) %{ ... code to convert fromtype to totype and return ... %} The special variable $from will be replaced by the name of the parameter of the type being converted from. The code must return the totype cast to void *. Example: class Time; class Date; Date &Time::dateFromTime(); %types(Time = Date) %{ Time *t = (Time *)$from; Date &d = t->dateFromTime(); return (void *) &d; %} resulting in the conversion / casting code looking something like: static void *_p_TimeTo_p_Date(void *x) { Time *t = (Time *)x; Date &d = t->dateFromTime(); return (void *) &d; } This is advanced usage, please use only if you understand the runtime type system. 01/30/2008: mgossage Small update to documentation in Typemaps.html, to warn about use of local variables in typemaps for multiple types. 01/25/2008: wsfulton [Java] Fix bug reported by Kevin Mills in ARRAYSOFCLASSES typemaps where any changes made to an array element passed from Java to C are not reflected back into Java. 01/24/2008: mgossage More updates to the configure script for detecting lua. Also looks in /usr/include/lua* Also changed typemaps.i not to check for NULL before freeing a pointer 01/21/2008: wsfulton [Python] For STL containers, SWIG no longer attempts to convert from one STL container to another, eg from std::vector to std::vector or std::list to std::vector or even std::vector to std::vector as it previously did. In fact SWIG no longer attempts to convert any SWIG wrapped C++ proxy class that is also a Python sequence, whereas previously it would. Any non-SWIG Python sequence will still be accepted wherever an STL container is accepted. Overloaded methods using containers should be faster. 01/18/2008: wsfulton [C#] Add 'directorinattributes' and 'directoroutattributes' typemap attributes for the imtype typemap. These should contain C# attributes which will be generated into the C# director delegate methods. 01/18/2008: olly Fix handling of byte value 255 in input files on platforms where char is signed (it was getting mapped to EOF). Fixes SF#1518219. 01/16/2008: wsfulton Fix template member variables wrapped by a smart pointer. Bug reported by Robert Lupton. 01/14/2008: mgossage Substantial changes to configure script for detecting lua. Code can now link to liblua.a, liblua50.a or liblua51.a It's also a lot neater now. 12/16/2007: wsfulton [Perl] Backed out #1798728 - numbers can be passed to functions taking char * 12/16/2007: wsfulton Fix #1832613 - Templates and some typedefs involving pointers or function pointers 12/12/2007: wsfulton [Java] Fix #1632625 - Compilation errors on Visual C++ 6 when using directors. 12/12/2007: wsfulton [Perl] Fix #1798728 - numbers can be passed to functions taking char *. 12/12/2007: wsfulton Fix #1819847 %template with just one default template parameter template class Foo {...}; %template(FooDefault) Foo<>; 12/12/2007: mgossage [Lua] Small correction on Lua.html 12/09/2007: wsfulton Apply patch #1838248 from Monty Taylor for vpath builds of SWIG. 12/08/2007: wsfulton [Lua] Fixes to remove gcc-4.2 warnings 12/06/2007: wsfulton Fix #1734415 - template template parameters with default arguments such as: template class t_alloc = pfc::alloc_fast > class list_t : public list_impl_t > { ... }; 12/04/2007: mgossage [lua] Fix a bug in the class hierachy code, where the methods were not propagated, if the name ordering was in a certain order. Added new example programs (dual, embed) and runtime tests for test-suite. 11/30/2007: wsfulton Fix using statements using a base class method where the methods were overloaded. Depending on the order of the using statements and method declarations, these were previously generating uncompilable wrappers, eg: struct Derived : Base { virtual void funk(); using Base::funk; }; Version 1.3.33 (November 23, 2007) ================================== 11/21/2007: mikel [allegrocl] omit private slot type info in the classes/types defined on the lisp side. Fix bug in mapping of C/++ types to lisp types. Fix typo in modules generated defpackage form. Have std::string *'s automatically marshalled between foreign and lisp strings. 11/20/2007: olly [Python] Fill in Python Dictionary functions list (patch from Jelmer Vernooij posted to swig-devel). 11/20/2007: beazley Fixed a bug in the C scanner related to backslash characters. 11/19/2007: wsfulton [Perl] Fix broken compilation of C++ wrappers on some compilers. 11/16/2007: olly [Python] Don't pass Py_ssize_t for a %d printf-like format as that's undefined behaviour when sizeof(Py_ssize_t) != sizeof(int). Version 1.3.32 (November 15, 2007) ================================== 11/14/2007: wsfulton [R] Package name and dll name is now the same as the SWIG module name. It used to be the module name with _wrap as a suffix. The package and dll names can be modified using the -package and -dll commandline options. *** POTENTIAL INCOMPATIBILITY *** 11/11/2007: wsfulton [R] Add support for Windows (Visual C++ 8 tested) 11/10/2007: olly [php] Fix makefile generated by -make (SF#1633679). Update documentation to mark "-make" as deprecated (none of the other SWIG backends seem to offer such a feature, it can't realistically generate a fully portable makefile, and the commands to build an extension are easy enough to write for the user's preferred build tool). Also recommend against the use of "-phpfull" (it's only really useful when static linking, and a dynamically loadable module is virtually always the better approach). 11/09/2007: olly Fix --help output to note that `export SWIG_FEATURES' is required. 10/29/2007: wsfulton [R] Fix seg fault on Windows [R] Examples R scripts are now platform independent 10/30/2007: mgossage [lua] fixed bug in template classes which cases template_default2 and template_specialization_defarg to fail. Added several warning filters into the overload's test cases. Added runtime tests for several codes. You can now make check-lua-test-suite with no errors and only a few warnings. 10/30/2007: olly [guile] Fix the configure test to put GUILELINK in LIBS not LDFLAGS (SF#1822430). 10/30/2007: olly [guile] Fix the guile examples on 64-bit platforms. 10/29/2007: wsfulton [C#] Fix member pointers on 64 bit platforms. 10/28/2007: olly [lua] Fix swig_lua_class instances to be static to allow multiple SWIG wrappers to be compiled into the same executable statically. Patch from Andreas Fredriksson (posted to the swig mailing list). 10/28/2007: olly [lua] Fix Examples/lua to pass SRCS for C tests rather than CXXSRCS. The code as it was happened to work on x86, but broke on x86_64 (and probably any other platforms which require -fPIC). 10/28/2007: wsfulton [Java, C#] New approach for fixing uninitialised variable usage on error in director methods using the new templated initialisation function SwigValueInit(). 10/28/2007: wsfulton [Perl] Use more efficient SvPV_nolen(x) instead of SvPV(x,PL_na) if SvPV_nolen is supported. 10/26/2007: wuzzeb [Chicken] Fix global variables of class member function pointers. Other minor fixes, so all tests in the chicken test suite now pass 10/25/2007: olly Fix UTL typecheck macro for a function taking char[] or const char[] (SF#1820132). 10/22/2007: mkoeppe [Guile] Filter out -ansi -pedantic from CFLAGS while compiling test programs for Guile in configure. This enables running the test suite for Guile if it is installed and usable. 10/22/2007: mkoeppe [Guile -scm] Fix testcases apply_signed_char and apply_strings by adding explicit casts to the appropriate $ltype. 10/22/2007: wsfulton [Java, C#] Fix uninitialised variable usage on error in director methods. 10/19/2007: wsfulton [Java, C#] Bug #1794247 - fix generated code for derived classes when csbase or javabase typemaps are used with the replace="1" attribute. 10/19/2007: wsfulton [Python] Docs updated to suggest using distutils. Patch #1796681 from Christopher Barker. 10/19/2007: olly [perl5] Clear errno before calls to strtol(), strtoul(), strtoll() and strtoull() which we check errno after to avoid seeing a junk value of errno if there isn't an error in the call. 10/16/2007: wsfulton Deprecate %attribute_ref and replace with %attributeref. There is just an argument order change in order to maintain consistency with %attribute, from: %attribute_ref(Class, AttributeType, AccessorMethod, AttributeName) to %attributeref(Class, AttributeType, AttributeName, AccessorMethod) 10/16/2007: olly [Tcl] Fix several occurrences of "warning: deprecated conversion from string constant to 'char*'" from GCC 4.2 in generated C/C++ code. 10/16/2007: olly [PHP] Fix many occurrences of "warning: deprecated conversion from string constant to 'char*'" from GCC 4.2 in generated C/C++ code when compiling with a new enough version of PHP 5 (tested with PHP 5.2.3, but PHP 5.2.1 is probably the minimum requirement). 10/15/2007: wsfulton Patch #1797133 from David Piepgrass fixes %attribute when the getter has the same name as the attribute name and no longer generate non-functional setter for read-only attributes. 10/15/2007: olly [Tcl] Prevent SWIG_Tcl_ConvertPtr from calling the unknown proc. Add Examples/tcl/std_vector/ which this change fixes. Patch is from "Cliff C" in SF#1809819. 10/12/2007: wsfulton [Java] Add DetachCurrentThread back in for directors. See entry dated 08/11/2006 and search for DetachCurrentThread on the mailing lists for details. The crashes on Solaris seem to be only present in jdk-1.4.2 and lower (jdk-1.5.0 and jdk-1.6.0 are okay), so anyone using directors should use a recent jdk on Solaris, or define (see director.swg) SWIG_JAVA_NO_DETACH_CURRENT_THREAD to the C++ compiler to get old behaviour. 10/12/2007: wsfulton [Java] Ensure the premature garbage collection prevention parameter (pgcpp) is generated when there are C comments in the jtype and jstype typemaps. 10/12/2007: wuzzeb Added a testsuite entry for Bug #1735931 10/09/2007: olly Automatically rerun autogen.sh if configure.in is modified. 10/09/2007: olly Enhance check-%-test-suite rule and friends to give a more helpful error message if you try them for a language which doesn't exist (e.g. "make check-php-test-suite" rather than the correct "make check-php4-test-suite"). 10/09/2007: olly Add make rule to regenerate Makefile from Makefile.in if it has changed. 10/09/2007: olly [php] Fix long-standing memory leak in wrapped constructors and wrapped functions/methods which return an object. 10/08/2007: olly Fix Makefile.in to read check.list files correctly in a VPATH build. 10/07/2007: wsfulton [C#, Java] Experimental shared_ptr typemaps added 09/27/2007: mgossage [lua] added more verbose error messages for incorrect typechecks. Added a routine which checks the exact number of parameters passed to a function (breaks operator_overloading for unary minus operator, currently disabled). Reorganised the luatypemaps.swg to tidy it up. Added a lot of %ignores on the operators not supported by lua. Added support for constant member function pointers & runtest for member_pointer.i Added first version of wchar.i 09/25/2007: wsfulton [C#, Java] throws typemaps for std::wstring using C# patch #1799064 from David Piepgrass 09/24/2007: wsfulton [Tcl] Apply #1771313 to fix bug #1650229 - fixes long long and unsigned long long handling. 09/20/2007: olly [Java] Eliminate some unnecessary uses of a temporary buffer allocated using new[]. SF#1796609. 09/19/2007: wsfulton [C#] The $csinput special variable can be used in the csvarin typemap where it is always expanded to 'value'. 09/19/2007: wsfulton [C#] Fix bug reported by Glenn A Watson and #1795260 where the cstype typemap used the 'ref' keyword in the typemap body, it produced uncompilable C# properties (variable wrappers). The type for the property now correctly comes from the 'out' attribute in the cstype typemap. 09/19/2007: wsfulton [Java] Fix const std::wstring& typemaps 09/19/2007: wsfulton [Java] Ensure the premature garbage collection prevention parameter (pgcpp) is generated where a parameter is passed by pointer reference, eg in the std::vector wrappers. The pgcpp is also generated now when user's custom typemaps use a proxy class in the jstype typemap and a 'long' in the jtype typemap. 09/18/2007: olly [php] Add typemaps for handling parameters of type std::string & which are modified by the wrapped function. 09/17/2007: olly [python] Split potentially long string literals to avoid hitting MSVC's low fixed limit on string literal length - patch from SF#1723770, also reported as SF#1630855. 09/17/2007: olly [ocaml] Fix renaming of overloaded methods in the method_table - my patch from SF#940399. 09/17/2007: olly [python] Simpler code for SWIG_AsVal_bool() which fixes a "strict aliasing" warning from GCC - patch from SF#1724581 by Andrew Baumann. 09/17/2007: olly [perl5] Use sv_setpvn() to set a scalar from a pointer and length - patch from SF#174460 by "matsubaray". 09/17/2007: olly When wrapping C++ code, generate code which uses std::string::assign(PTR, LEN) rather than assigning std::string(PTR, LEN). Using assign generates more efficient code (tested with GCC 4.1.2). 09/07/2007: wsfulton Fix %ignore on constructors which are not explicitly declared [SF #1777712] 09/05/2007: wuzzeb (John Lenz) - Change r_ltype in typesys.c to store a hashtable instead of a single value. several very subtle bugs were being caused by multiple ltypes being mapped to a single mangled type, mostly when using typedefed template parameters. Now, r_ltype stores a hashtable of possible ltypes, and when generating the type table, all the ltypes are added into the swig_type_info structure. 08/31/2007: wsfulton SF #1754967 from James Bigler. - Fix bug in turning on warnings that were turned off by default. Eg 'swig -w+309' will now turn on the normally suppressed warning 309. - New -Wextra commandline option which enables the extra warning numbers: 202,309,403,512,321,322 (this is the list of warnings that have always been suppressed by default). By specifying -Wextra, all warnings will be turned on, but unlike -Wall, warnings can still be selectively turned on/off using %warnfilter, #pragma SWIG nowarn or further -w commandline options, eg: swig -Wextra -w309 will turn on all warnings except 309. 08/28/2007: wsfulton - New debugging options, -debug-module and -debug-top to display the parse tree at various stages, where is a comma separated list of stages 1-4.For example, to display top of parse tree at stages 1 and 3: swig -debug-top 1,3 - Deprecate the following options which have equivalents below: -dump_parse_module => -debug-module 1 -dump_module => -debug-module 4 -dump_parse_top => -debug-top 1 -dump_top => -debug-top 4 - Renamed some commandline options for naming consistency across all options: -debug_template => -debug-template -debug_typemap => -debug-typemap -dump_classes => -debug-classes -dump_tags => -debug-tags -dump_typedef => -debug-typedef -dump_memory => -debug-memory 08/25/2007: olly [PHP5] Fix handling of double or float parameters with an integer default value. 08/25/2007: olly [PHP5] Generate __isset() methods for setters for PHP 5.1 and later. 08/20/2007: wsfulton [Java C#] Fix director bug #1776651 reported by Stephane Routelous which occurred when the director class name is the same as the start of some other symbols used within the director class. 08/17/2007: wsfulton Correct behaviour for templated methods used with %rename or %ignore and the empty template declaration - %template(). A warning is issued if the method has not been renamed. 08/16/2007: mutandiz (Mikel Bancroft) [allegrocl] Name generated cl file based on input file rather than by module name. It was possible to end up with a mypackage.cl and a test_wrap.c when parsing a test.i input file. Confusing. Also, include external-format templates for :fat and :fat-le automatically to avoid these being compiled at runtime. 08/15/2007: efuzzyone [cffi] Apply patch #1766076 from Leigh Smith adding support for newly introduced in cffi :long-long and :unsigned-long-long. 08/10/2007: wsfulton [Java] Add documentation patch #1743573 from Jeffrey Sorensen. It contains a neat idea with respect to better memory management by the JVM of C++ allocated memory. 08/10/2007: wsfulton [Perl] Apply patch #1771410 from Wade Brainerd to fix typedef XS(SwigPerlWrapper) in perlrun.swg for ActiveState Perl build 822 and Perl 5.8.9 and 5.10 branches. 08/10/2007: wsfulton [Lua] const enum reference typemaps fixed. 08/09/2007: wsfulton [C#] Added missing support for C++ class member pointers. 08/09/2007: wsfulton [C#, Java] Add support for $owner in the "out" typemaps like in the scripting language modules. Note that $owner has always been supported in the "javaout" / "csout" typemaps. 08/01/2007: wsfulton Fix smart pointer handling for classes that have templated methods within the smart pointer type. Problem reported by craigdo at ee.washington.edu. 07/31/2007: efuzzyone [cffi] fixed memory access after being freed bug. thanks to Martin Percossi. package name clos changed to cl. thanks to Ralf Mattes 07/24/2007: wsfulton Parallel make support added for the examples and test-suite for developers who have more than one CPU. Now parallel make can be used for checking in addition to building the SWIG executable. Some typical checking examples: make -j8 -k check make -j4 check-java-test-suite make -j2 check-java-examples 07/19/2007: mgossage Fixed bug that stopped configure working on mingw (applied dos2unix to configure.in) 07/10/2007: mgossage [lua] Extra compatibility with Lua 5.1 (updated SWIG_init, docs, examples, test suite) Removed name clash for static link of multiple modules 07/05/2007: mgossage [lua] Fix a bug in SWIG_ALLOC_ARRAY() improved the error messages for incorrect arguments. Changed the output of swig_type() to use the human readable form of the type, rather than the raw swig type. 07/03/2007: wsfulton [C#] Fix directors for some overloaded methods where the imtype resulted in identical methods being generated in the C# director class, eg void foo(int *) and void foo(double *) used to generated two of these: private void SwigDirectorfoo(IntPtr p) { ... } 06/25/2007: wsfulton [Java, C#] Some parameter name changes in std_vector.i allowing better targeting of typemaps for method parameters (for memory management of containers of pointers). 06/07/2007: mutandiz (Mikel Bancroft) [allegrocl] fix foreign-type constructor to properly look for ffitype typemap bindings. fix inout_typemaps.i for strings. 06/06/2007: olly [Ruby] Use whichever of "long" or "long long" is the same size as "void*" to hold pointers as integers, rather than whichever matches off_t. Fixes compilation on OS X and GCC warnings on platforms where sizeof(void*) < sizeof(off_t) (SF patch #1731979). 06/06/2007: olly [PHP5] Fix handling of a particular case involving overloaded functions with default parameters. 06/05/2007: mutandiz (Mikel Bancroft) [allegrocl] Fix case where we'd pass fully qualified identifiers (i.e. NS1::NS2::FOO) to swig-insert-id. All namespaces should be stripped. Fix bug in TypedefHandler introduced by last fix. 06/05/2007: olly Fix reporting of filenames in errors after %include (patch from Leigh Smith in #1731040; also reported as #1699940). 05/31/2007: olly [Python] Fix "missing initialiser" warning when compiling generated C/C++ wrapper code with Python 2.5 with warnings enabled (patch from bug#1727668 from Luke Moore). 05/29/2007: olly [Python] Split docstrings into separate string literals at each newline when generating C/C++ wrapper code (the C/C++ compiler will just combine them back into a single string literal). This avoids MSVC complaining that the strings are too long (problem reported by Bo Peng on the mailing list). 05/28/2007: olly [Python] Escape backslashes in docstrings. 05/26/2007: olly [Python] Fix autodoc generation of enums to be more consistent with how the enums are wrapped - patch #1697226 from Josh Cherry. 05/26/2007: olly [PHP5] Fix wrapping of methods and functions which return a pointer to a class (bug#1700788) and those which have overloaded forms returning both classes and non-classes (bug#1712717, thanks to Simon Berthiaume for the patch). 05/25/2007: wsfulton Fixed %rename inconsistency in conversion operators as reported by Zhong Ren. The matching is now done on the operator name in the same way as it is done for parameters. For example: %rename(opABC) Space::ABC::operator ABC() const; %rename(methodABC) Space::ABC::method(ABC a) const; namespace Space { class ABC { public: void method(ABC a) const {} operator ABC() const { ABC a; return a; } }; } Note that qualifying the conversion operator previously may or may not have matched. Now it definitely won't, so this will not match: %rename(opABC) Space::ABC::operator Space::ABC() const; in the same way that this does not match: %rename(methodABC) Space::ABC::method(Space::ABC a) const; The documentation has been improved with respect to %rename, namespaces and templates. Conversion operators documentation too. *** POTENTIAL INCOMPATIBILITY *** 05/16/2007: mutandiz [allegrocl] Fix bad generation of local var ltype's in functionWrapper(). Try to work better with the backward order in which swig unrolls nested class definitions. cleaned up a little unnecessary code/debug printf's. Remove warning when replacing $ldestructor for ff:foreign-pointer 05/12/2007: olly [Python] swig -python -threads now generates C/C++ code which uses Python's own threading abstraction (from pythread.h) rather than OS specific code. The old code failed to compile on MS Windows. (See SF patch tracker #1710341). 05/04/2007: gga [Ruby] Changed STL renames to be global renames. This fixes STL functions not being renamed when autorename is on. This is a not a totally perfect work-around, but better. Someone really needs to fix the template renaming code. (See bug #1545634) 05/04/2007 gga [All] Changed %rename("%(undercase)s") a little so that single numbers at the end of a function are not undercased. That is: getSomething -> get_something get2D -> get_2d get234 -> get_234 BUT: asFloat2 -> as_float2 (Bug #1699714) 05/03/2007: gga [Ruby] Made __swigtype__ => @__swigtype__ so it can be accessed from the scripting language (and follows Ruby's official documentation, just in case). Made tracking => @__trackings__ for same reason. Currently storing ivars without the @ seems valid, but the PickAxe says this is not correct, so just in case... 05/03/2007: gga [Ruby] Applied patch for -minherit bug and exception classes. This issue should be revisited more closely, as Multiple Inheritance in Ruby is still problematic. (patch/bug #1604878) 05/03/2007: gga [Ruby] Overloaded functions in ruby will now report to the user the possible prototypes when the user mistypes the number or type of a parameter. 05/03/2007: gga [Ruby] Forgot to document the bug fixing of an old bug regarding exceptions. (bug #1458247) 05/03/2007: gga [Ruby] Fixed Ruby documentation to use the proper css styles for each section. Added autodoc section to Ruby's docs to document the features supported by Ruby in documenting its modules. Made rdoc documentation spit out the full name of the class + method name. Albeit this will make the current rdoc not recognize the method, this is still needed to disambiguate between different classes with similar methods (rdoc was created to document the ruby source which only contains one class per c file, unlike swig) I have patched rdoc to make it more friendly to swig. This patch needs to be merged in the ruby std library now. 05/03/2007: gga [Ruby] Changed flag -feature to be -init_name to better reflect its purpose and avoid confusion with -features. 05/03/2007: gga [Ruby] Improved autodoc generation. Added autodoc .swg files to Ruby library for easily adding documentation to common Ruby methods and STL methods. Fixed autodoc documenting of getters and setters and module. Made test suite always generate autodocs. 05/03/2007: gga [Ruby] Removed some warnings from STL and test suite. 05/02/2007: mgossage [Lua] Fixed issues with C++ classes and hierachies across multiple source files. Fixed imports test case & added run test. Added Examples/imports. Added typename for raw lua_State* Added documentation on native functions. 05/02/2007: gga [Ruby] Docstrings are now supported. %feature("autodoc") and %feature("docstring") are now properly supported in Ruby. These features will generate a _wrap.cxx file with rdoc comments in them. 05/02/2007: gga [Ruby] STL files have been upgraded to follow the new swig/python Lib/std conventions. This means std::vector, std::set, std::map, set::multimap, std::multiset, std::deque and std::string are now properly supported, including their iterators, support for containing ruby objects (swig::GC_VALUE) and several other ruby enhancements. std::complex, std::ios, std::iostream, std::iostreambuf and std::sstream are now also supported. std::wstring, std::wios, std::wiostream, std::wiostreambuf and std::wsstream are supported verbatim with no unicode conversion. std_vector.i now mimics the behavior of Ruby Arrays much more closely, supporting slicing, shifting, unshifting, multiple indexing and proper return values on assignment. COMPATABILITY NOTE: this changes the older api a little bit in that improper indexing would previously (incorrectly) raise exceptions. Now, nil is returned instead, following ruby's standard Array behavior. 05/02/2007: gga [Ruby] Changed the value of SWIG_TYPECHECK_BOOL to be 10000 (ie. higher than that of all integers). This is because Ruby allows typecasting integers down to booleans which can make overloaded functions on bools and integers to fail. (bug# 1488142) 05/02/2007: gga [Ruby] Fixed a subtle bug in multiple argouts that could get triggered if the user returned two or more arguments and the first one was an array. 05/01/2007: gga [Ruby] Improved the documentation to document the new features added, add directorin/out/argout typemaps, etc. 05/01/2007: gga [Ruby] Added %initstack and %ignorestack directives for director functions. These allow you to control whether a director function should re-init the Ruby stack. This is sometimes needed for an embedded Ruby where the director method is used as a C++ callback and not called by the user from ruby code. Explanation: Ruby's GC needs to be aware of the running OS stack in order to mark any VALUE (Ruby objects) it finds there to avoid collection of them. This allows the ruby API to be very simple and allows you to write code like "VALUE a = sth" anywhere without needing to do things like refcounting like python. By default, the start of the stack is set when ruby_init() is called. If ruby is inited within main(), as it usually is the case with the main ruby executable, ruby will be able to calculate its stack properly. However, when this is not possible, as when ruby is embedded as a plugin to an application where main is not available, ruby_init() will be called in the wrong place, and ruby will be incorrectly tracking the stack from the function that called ruby_init() forwards only, which can lead to all sorts of weird crashes or to ruby thinking it has run out of stack space incorrectly. To avoid this, director (callback) functions can now be tagged to try to reset the ruby stack, which will solve the issues. NOTE: ruby1.8.6 still contains a bug in it in that its function to reset the stack will not always do so. This bug is triggered very rarely, when ruby is called from two very distinct places in memory, like a branch of main() and another dso. This bug has now been reported to ruby-core and is pending further investigation. (bug #1700535 and patch #1702907) 04/30/2007: wsfulton Fix #1707582 - Restore building from read-only source directories. 04/30/2007: gga [Ruby] Ruby will now report the parameter index properly on type errors as well as the class and value of the incorrect argument passed. (feature request #1699670) 04/30/2007: gga [Ruby] Ruby no longer creates the free_Class function if the class contains its own user defined free function (%freefunc). (bug #1702882) 04/30/2007: gga [Ruby] Made directors raise a ruby exception for incorrect argout returned values if RUBY_EMBEDDED is set, instead of throwing an actual SwigDirector exception. This will prevent crashes when ruby is embedded and unaware of the SwigDirector exception. 04/30/2007: gga [Ruby] Removed the need for -DSWIGEXTERN. Changed swig_ruby_trackings to be a static variable, but also be kept within a hidden instance variable in the SWIG module. This allows properly dealing with trackings across multiple DSOs, which was previously broken. (bug #1700535 and improvement to patch #1702907) 04/29/2007: gga [Ruby] Fixed GC memory issues with trackings that could lead to segfaults when dealing, mainly, with static variables. (bug #1700535 and patch #1702907) 04/29/2007: gga [Ruby] Fixed String conversion using old ruby1.6 macros. Now StringValuePtr() is used if available. This removes warnings when converting strings with \0 in them. (bug #1700535 and patch #1702907) 04/29/2007: gga [Ruby] Fixed the argout count in directors for Ruby. Previously, ignored or "numinputs=0" typemaps would incorrectly not get counted towards the argout count. (bug/patch #1545585) 04/29/2007: gga [Ruby] Upgraded Ruby converter to recognize "numinputs=0". Previously, only the old "ignore" flag was checked (which would currently still work properly, but is deprecated). 04/29/2007: gga [Ruby - but should be made generic] %feature("numoutputs","0") added. This feature allows you to ignore the output of a function so that it is not added to a list of output values ( ie. argouts ). This should also become a feature of %typemap(directorout) as "numoutputs"=0, just like "numinputs"=0 exists. %feature("directors"=1) %include %feature("numoutputs","0") { Class::member_function1 }; %typemap(out) MStatus { // some code, like check mstatus // and raise exception if wrong }; %inline %{ typedef int MStatus; class Class { // one argument returned, but director out code added // MStatus is discarded as a return (out) parameter. virtual MStatus member_function1( int& OUTPUT ); // two arguments returned, director out code added // MStatus is not discarded virtual MStatus member_function2( int& OUTPUT ); }; %} 04/21/2007: olly Fix parsing of float constants with an exponent (e.g. 1e-02f) (bug #1699646). 04/20/2007: olly [Python] Fix lack of generation of docstrings when -O is used. Also, fix generation of docstrings containing a double quote character. Patch from Richard Boulton in bug#1700146. 04/17/2007: wsfulton [Java, C#] Support for adding in Java/C# code before and after the intermediary call, specifically related to the marshalling of the proxy type to the intermediary type. The javain/csin typemap now supports the 'pre' and 'post' attributes to achieve this. The javain typemap also supports an optional 'pgcppname' attribute for premature garbage collection prevention parameter naming and the csin typemap supports an optional 'cshin' attribute for the parameter type used in a constructor helper generated when the type is used in a constructor. Details in the Java.html and CSharp.html documentation. 04/16/2007: olly Don't treat `restrict' as a reserved identifier in C++ mode (bug#1685534). 04/16/2007: olly [PHP5] Fix how zend_throw_exception() is called (bug #1700785). 04/10/2007: olly Define SWIGTEMPLATEDISAMBIGUATOR to template for aCC (reported on swig-user that this is needed). 04/04/2007: olly [PHP5] If ZTS is enabled, release _globals_id in MSHUTDOWN to avoid PHP interpreter crash on shutdown. This solution was suggested here: http://bugs.php.net/bug.php?id=40985 04/03/2007: olly [PHP4] Add missing ZTS annotations to generated C++ wrapper code to fix compilation failures when using ZTS enabled SWIG (Linux distributions tend to disable ZTS, but notably the Windows build uses it by default). 04/01/2007: efuzzyone [CFFI] Patch #1684261: fixes handling of unsigned int literals, thanks Leigh Smith. Also, improved documentation. 03/30/2007: olly Avoid generating '<:' token when using SwigValueWrapper<> on a type which starts with '::' (patch #1690948). 03/25/2007: wuzzeb (John Lenz) [perl5] Add SWIG_fail to the SWIG_exception macro. Fixes a few problems reported on the mailing list. 03/23/2007: wsfulton String copying patch from Josh Cherry reducing memory consumption by about 25%. 03/21/2007: wsfulton [Java] Apply patch #1631987 from Ulrik Peterson - bool INOUT typemaps fail on big endian machines. 03/16/2007: wsfulton Fix seg fault given dodgy C++ code: namespace abc::def { } 03/16/2007: wsfulton [Java] Fixes so that ARRAYSOFCLASSES and ARRAYSOFENUMS in arrays_java.i can be applied to pointer types. 03/03/2007: olly [PHP5] When we know the literal numeric value for a constant, use that to initialise the const member in the PHP wrapper class. 03/02/2007: olly [PHP5] Fix PHP wrapper code generated for certain cases of overloaded forms with default arguments. 02/26/2007: efuzzyone [CFFI] Patch #1656395: fixed hex and octal values bug, thanks to Arthur Smyles. 02/22/2007: mgossage [Lua] Fixed bug in typemaps which caused derived_byvalue and rname test cases to fail. Updated derived_byvalue.i to explain how to find and fix the problem 01/25/2007: wsfulton Fix #1538522 and #1338527, forward templated class declarations without a name for the templated class parameters, such as: template class X; 01/23/2007: mgossage [Lua] Patch #1640862: replaced by Patch #1598063 Typo in typemaps.i 01/22/2007: mgossage [Lua] Added a lua specific carrays.i which adds the operator[] support. modified the main code to make it not emit all the class member functions & accessors Note: C structs are created using new_XXX() while C++ classes use XXX() (should be standardised) Updated test case: li_carrays Updated the documentation. 01/12/2007: wsfulton [Php] Add support for newfree typemaps (sometimes used by %newobject) 01/12/2007: beazley New command line option -macroerrors. When supplied, this will force the C scanner/parser to report proper location information for code contained inside SWIG macros (defined with %define). By default, SWIG merely reports errors on the line at which a macro is used. With this option, you can expand the error back to its source---something which may simplify debugging. 01/12/2007: beazley [Internals] Major overhaul of C/C++ scanning implementation. For quite some time, SWIG contained two completely independent C/C++ tokenizers-- the legacy scanner in CParse/cscanner.c and a general purpose scanner in Swig/scanner.c. SWIG still has two scanning modules, but the C parser scanner (CParse/cscanner.c) now relies upon the general purpose scanner found in Swig/scanner.c. As a result, it is much smaller and less complicated. This change also makes it possible to maintain all of the low-level C tokenizing in one central location instead of two places as before. ***POTENTIAL FLAKINESS*** This change may cause problems with accurate line number reporting as well as error reporting more generally. I have tried to resolve this as much as possible, but there might be some corner cases. 01/12/2007: mgossage [Lua] Added typemap throws for std::string*, typemap for SWIGTYPE DYNAMIC, changed the existing throws typemap to throw a string instead of making a copy of the object (updating a few test cases to deal with the change). fixed test case: dynamic_casts, exception_partial_info, li_std_string, size_t 01/03/2007: beazley [Internals]. Use of swigkeys.c/.h variables is revoked. Please use simple strings for attribute names. 12/30/2006: beazley Internal API functions HashGetAttr() and HashCheckAttr() have been revoked. Please use Getattr() to retrieve attributes. The function Checkattr() can be used to check attributes. Note: These functions have been revoked because they only added a marginal performance improvement at the expense code clarity. 12/26/2006: mgossage [Lua] Added more STL (more exceptions, map, size_t), fixed test case: conversion_ns_template. 12/21/2006: mgossage [Lua] Update to throw errors when setting immutables, and allowing user addition of module variables. 12/20/2006: wsfulton Fix typedef'd variable wrappers that use %naturalvar, eg, std::string. 12/14/2006: wsfulton [C#] Add std::wstring and wchar_t typemaps 12/14/2006: olly [php] Fix bug #1613673 (bad PHP5 code generated for getters and setters). 12/02/2006: wsfulton, John Lenz, Dave Beazley Move from cvs to Subversion for source control 11/30/2006: beazley Cleaned up swigwarnings.swg file not to use nested macro definitions. 11/12/2006: wsfulton [Java, C#] Fix for %extend to work for static member variables. Version 1.3.31 (November 20, 2006) ================================== 11/12/2006: Luigi Ballabio [Python] Alternate fix for Python exceptions bug #1578346 (the previous one broke Python properties in modern classes) 11/12/2006: wsfulton -fakeversion commandline option now generates the fake version into the generated wrappers as well as displaying it when the -version commandline option is used. 14/11/2006: mgossage [lua] update to typemap for object by value, to make it c89 compliant Version 1.3.30 (November 13, 2006) ================================== 11/12/2006: wsfulton [java] Remove DetachCurrentThread patch from 08/11/2006 - it causes segfaults on some systems. 11/12/2006: wsfulton [python] Fix #1578346 - Python exceptions with -modern 11/10/2006: wsfulton Fix #1593291 - Smart pointers and inheriting from templates 11/09/2006: wsfulton Fix director operator pointer/reference casts - #1592173. 11/07/2006: wsfulton Add $self special variable for %extend methods. Please use this instead of just 'self' as the C++ 'this' pointer. 11/07/2006: mutandiz [allegrocl] allegrocl.swg: swig-defvar updated to allow specifying of non-default foreign type (via :ftype keyword arg). allegrocl.cxx: Specify proper access type for enum values. 11/03/2006: wsfulton [Java/C#] Fix const std::string& return types for directors as reported by Mark Donselzmann 10/29/2006: wsfulton [Java] Remove DeleteLocalRef from end of director methods for now as it is causing a seg fault when run on Solaris 8. 10/29/2006: wuzzeb (John Lenz) [Guile] Patch from Chris Shoemaker to clean up some warnings in the generated code. 10/29/2006: wsfulton [Java] Important fix to prevent early garbage collection of the Java proxy class while it is being used in a native method. The finalizer could destroy the underlying C++ object while it was being used. The problem occurs when the proxy class is no longer strongly reachable after a native call. The problem seems to occur in memory stress situations on some JVMs. It does not seem to occur on the Sun client JVM up to jdk 1.5. However the 1.6 client jdk has a more aggressive garbage collector and so the problem does occur. It does occur on the Sun server JVMs (certainly 1.4 onwards). The fix entails passing the proxy class into the native method in addition to the C++ pointer in the long parameter, as Java classes are not collected when they are passed into JNI methods. The extra parameter can be suppressed by setting the nopgcpp attribute in the jtype typemap to "1" or using the new -nopgcpp commandline option. See Java.html#java_pgcpp for further details on this topic. 10/24/2006: wsfulton [C#] Fix smart pointer wrappers. The virtual/override/new keyword is not generated for each method as the smart pointer class does not mirror the underlying pointer class inheritance hierarchy. SF #1496535 10/24/2006: mgossage [lua] added support for native methods & member function pointers. fixed test cases arrays_dimensionless & cpp_basic. Added new example (functor). tidied up a little of the code (around classHandler). 10/17/2006: wsfulton [C#, Java] directorout typemap changes to fall in line with the other director languages. $result is now used where $1 used to be used. Please change your typemaps if you have a custom directorout typemap. 10/18/2006: wsfulton Some fixes for applying the char array typemaps to unsigned char arrays. 10/17/2006: wsfulton [C#, Java] Add in const size_t& and const std::size_t& typemaps. 10/15/2006: efuzzyone [CFFI] Suppress generating defctype for enums, thanks to Arthur Smyles. Patch 1560983. 10/14/2006: wuzzeb (John Lenz) [Chicken] Minor fix to make SWIG work with the (as yet unreleased) chicken 2.5 [Guile,Chicken] Fix SF Bug 1573892. Added an ext_test to the test suite to test this bug, but this test can not really be made generic because the external code must plug into the target language interpreter directly. See Examples/test-suite/chicken/ext_test.i and ext_test_external.cxx Added a %.externaltest to common.mk, and any interested language modules can copy and slightly modify either the chicken or the guile ext_test.i 10/14/2006: mgossage [Lua] added OUTPUT& for all number types, added a long long type fixed several test cases. update: changed typemaps to use SWIG_ConvertPtr rather than SWIG_MustGetPointer started spliting lua.swg into smaller parts to make it neater 10/13/2006: wsfulton [C#, Java] Marginally better support for multiple inheritance only in that you can control what the base class is. This is done using the new 'replace' attribute in the javabase/csbase typemap, eg in the following, 'Me' will be the base class, no matter what Foo is really derived from in the C++ layer. %typemap(javabase, replace="1") Foo "Me"; %typemap(csbase, replace="1") Foo "Me"; Previously it was not possible for the javabase/csbase typemaps to override the C++ base. 10/12/2006: wsfulton [Java] Remove potential race condition on the proxy class' delete() method (it is now a synchronized method, but is now customisable by changing the methodmodifiers attribute in the javadestruct or javadestruct_derived typemap) [C#] Remove potential race condition on the proxy class' Dispose() method, similar to Java's delete() above. *** POTENTIAL INCOMPATIBILITY *** 10/12/2006: wsfulton [Ruby, Python] Remove redundant director code in %extend methods (%extend methods cannot be director methods) 10/12/2006: wsfulton [Ruby, Python] Fix #1505594 - director objects not returned as director objects in %extend methods. 10/11/2006: wsfulton [Java] Fix #1238798 - Directors using unsigned long long or any other type marshalled across the JNI boundary using a Java class (where the jni typemap contains jobject). 10/06/2006: wsfulton Fix #1162194 - #include/%include within a structure 10/06/2006: wsfulton Fix #1450661, string truncation in String_seek truncating Java/C# enums. 10/06/2006: mgossage [Lua] Fix #1569587. The name is now correct. 10/04/2006: wsfulton Director fixes for virtual conversion operators 10/04/2006: olly [php] Fix #1569587 for PHP. Don't use sizeof() except with string literals. Change some "//" comments to "/* */" for portability. 10/04/2006: mgossage [Lua] Partial Fix #1569587. The type is now correct, but the name is still not correct. 10/03/2006: wsfulton [Ruby] Fix #1527885 - Overloaded director virtual methods sometimes produced uncompilable code when used with the director:except feature. 10/03/2006: wsfulton Directors: Directors are output in the order in which they are declared in the C++ class rather than in some pseudo-random order. 10/03/2006: mmatus Fix #1486281 and #1471039. 10/03/2006: olly [Perl] Fix for handling strings with zero bytes from Stephen Hutsal. 09/30/2006: efuzzyone [CFFI] Bitfield support and vararg support due to Arthur Smyles. C expression to Lisp conversion, thanks to Arthur Smyles for the initial idea, it now supports conversion for a whole range of C expressions. 09/28/2006: wsfulton Fix #1508327 - Overloaded methods are hidden when using -fvirtual optimisation. Overloaded methods are no longer candidates for elimination - this mimics C++ behaviour where all overloaded methods must be defined and implemented in a derived class in order for them to be available. 09/25/2006: wsfulton [Ruby, Python, Ocaml] Fix #1505591 Throwing exceptions in extended directors 09/25/2006: wsfulton Fix #1056100 - virtual operators. 09/24/2006: olly Don't accidentally create a "<:" token (which is the same as "[" in C++). Fixes bug # 1521788. 09/23/2006: olly [Ruby] Support building with recent versions of the Ruby 1.9 development branch. Fixes bug #1560092. 09/23/2006: olly Templates can now be instantiated using negative numbers and constant expressions, e.g.: template class x {}; %template(x_minus1) x<-1>; %template(x_1plus2) x<1+2>; Also, constant expressions can now include comparisons (>, <, >=, <=, !=, ==), modulus (%), and ternary conditionals (a ? b : c). Fixes bugs #646275, #925555, #956282, #994301. 09/22/2006: wsfulton Fix %ignore on director methods - Bugs #1546254, #1543533 09/20/2006: wsfulton Fix %ignore on director constructors 09/20/2006: wsfulton Fix seg faults and asserts when director methods are ignored (#1543533) 09/20/2006: wsfulton Fix out of source builds - bug #1544718 09/20/2006: olly Treat a nested class definition as a forward declaration rather than ignoring it completely, so that we generate correct code for passing opaque pointers to the nested class (fixes SF bug #909387). 09/20/2006: olly *** POTENTIAL INCOMPATIBILITY *** [php] Overload resolution now works. However to allow this, SWIG generated wrappers no longer coerce PHP types (which reverts a change made in 1.3.26). So for example, if a method takes a string, you can no longer pass a number without explicitly converting it to a string in PHP using: (string)x 09/18/2006: mgossage [ALL] fix on swiginit.swg, has been reported to crash on several test cases found and fixed problem in imports under python (mingw) 09/16/2006: wsfulton [Python] Patch from Michal Marek for Python 2.5 to fix 64 bit array indexes on 64 bit machines. 09/13/2006: wsfulton The explicitcall feature has been scrapped. This feature was introduced primarily to solve recursive director method calls. Director upcall improvements made instead: [Python, Ruby, Ocaml] The swig_up flag is no longer used. The required mutexes wrapping this flag are also no longer needed. The recursive calls going from C++ to the target language and back again etc are now avoided by a subtlely different approach. Instead of using the swig_up flag in each director method to indicate whether the explicit C++ call to the appropriate base class method or a normal polymorphic C++ call should be made, the new approach makes one of these calls directly from the wrapper method. [Java, C#] The recursive call problem when calling a C++ base class method from Java/C# is now fixed. The implementation is slightly different to the other languages as the detection as to whether the explicit call or a normal polymorphic call is made in the Java/C# layer rather than in the C++ layer. 09/11/2006: mgossage [ALL] updated swiginit.swg to allow multiple interpreters to use multiple swig modules at once. This has been tested in Lua (mingw & linux), perl5 & python (linux) only. 09/11/2006: mgossage [lua] added support for passing function pointers as well as native lua object into wrappered function. Added example funcptr3 to demonstrate this feature 09/05/2006: olly [php] Rename ErrorCode and ErrorMsg #define-s to SWIG_ErrorCode and SWIG_ErrorMsg to avoid clashes with code the user might be wrapping (patch from Darren Warner in SF bug #1466086). Any user typemaps which use ErrorCode and/or ErrorMsg directly will need adjusting - you can easily fix them to work with both old and new SWIG by changing to use SWIG_ErrorMsg and adding: #ifndef SWIG_ErrorMsg #define SWIG_ErrorMsg() ErrorMsg() #endif 08/29/2006: olly [php] Move constant initialisation from RINIT to MINIT to fix a warning when using Apache and mod_php. We only need to create PHP constants once when we're first initialised, not for every HTTP request. 08/21/2006: mgossage [Lua] Bugfix #1542466 added code to allow mapping Lua nil's <-> C/C++ NULL's updated various typemaps to work correctly with the changes added voidtest_runme.lua to show the features working 08/19/2006: wuzzeb (John Lenz) [Guile] Add feature:constasvar to export constants as variables instead of functions that return the constant value. 08/11/2006: wsfulton [Java] DetachCurrentThread calls have been added so that natively created threads no longer prevent the JVM from exiting. Bug reported by Thomas Dudziak and Paul Noll. 08/10/2006: wsfulton [C#] Fix director protected methods so they work 07/25/2006: mutandiz [allegrocl] more additions to std::string, some tweaks and small bug fixes -nocwrap mode. 07/21/2006: mgossage [Lua] Bugfix #1526022 pdated std::string to support strings with '\0' inside them updated typemaps.i to add support for pointer to pointers 07/19/2006: mutandiz [allegrocl] - Add std_string.i support. - Add newobject patch submitted by mkoeppe (thanks!) - Fix type name mismatch issue for nested type definitions. specifically typedefs in templated class defns. 07/18/2006: mgossage Bugfix #1522858 updated lua.cxx to support -external-runtime command 07/14/2006: wuzzeb (John Lenz) Increment the SWIG_RUNTIME_VERSION to 3, because of the addition of the owndata member in swig_type_info. Reported by: Prabhu Ramachandran 07/05/2006: wsfulton Search path fixes: - Fix search path for library files to behave as documented in Library.html. - Fix mingw/msys builds which did not find the SWIG library when installed. - Windows builds also output the mingw/msys install location when running swig -swiglib. - The non-existent and undocumented config directory in the search path has been removed. 07/05/2006: wsfulton Fix $symname special variable expansion. 07/04/2006: wuzzeb (John Lenz) [Chicken] Add %feature("constasvar"), which instead of exporting a constant as a scheme function, exports the constant as a scheme variable. Update the documentation as well. 07/04/2006: wsfulton [See entry of 09/13/2006 - explicitcall feature and documentation to it removed] New explicitcall feature which generates additional wrappers for virtual methods that call the method explicitly, not relying on polymorphism to make the method call. The feature is a feature flag and is enabled like any other feature flag. It also recognises an attribute, "suffix" for mangling the feature name, see SWIGPlus.html#SWIGPlus_explicitcall documentation for more details. [Java, C#] The explicitcall feature is also a workaround for solving the recursive calls problem when a director method makes a call to a base class method. See Java.html#java_directors_explicitcall for updated documentation. 06/28/2006: joe (Joseph Wang) [r] Initial support for R 06/20/2006: wuzzeb (John Lenz) [Chicken] Minor fixes to get apply_strings.i testsuite to pass Remove integers_runme.scm from the testsuite, because SWIG and Chicken does handle overflows. 06/19/2005: olly [php] Add support for generating PHP5 class wrappers for C++ classes (use "swig -php5"). 06/17/2006: olly [php] Added some missing keywords to the PHP4 keyword list, and fixed __LINE__ and __FILE__ which were in the wrong category. Also added all the keywords new in PHP5, and added comments noting the PHP4 keywords which aren't keywords in PHP5. 06/17/2006: olly [php] Don't segfault if PHP Null is passed as this pointer (e.g. Class_method(Null)) - give a PHP Error instead. 06/15/2006: mutandiz [allegrocl] Add initial support for std::list container class. Fix a few bugs in helper functions. 05/13/2006: wsfulton [Java] Replace JNIEXPORT with SWIGEXPORT, thereby enabling the possibility of using gcc -fvisibility=hidden for potentially smaller faster loading wrappers. 05/13/2006: wsfulton Fix for Makefiles for autoconf-2.60 beta 05/13/2006: wsfulton Vladimir Menshakov patch for compiling wrappers with python-2.5 alpha. 05/12/2006: wsfulton Fix buffer overflow error when using large %feature(docstring) reported by Joseph Winston. 05/12/2006: wsfulton [Perl] Operator overload fix from Daniel Moore. 05/25/2006: mutandiz [allegrocl] Fix bug in generation of CLOS type declarations for unions and equivalent types. 05/24/2006: mutandiz [allegrocl] Don't require a full class definition to generate a CLOS wrapper. 05/20/2006: olly [php] GCC Visibility support now works with PHP. 05/19/2006: olly [php] Removed support for -dlname (use -module instead). Fixed naming of PHP extension module to be consistent with PHP conventions (no "php_" prefix on Unix; on PHP >= 4.3.0, handle Unix platforms which use something other than ".so" as the extension.) 05/13/2006: wsfulton [C#] Director support added 05/07/2006: olly [php] Don't segfault if PHP Null is passed where a C++ reference is wanted. 05/05/2006: olly [php] Fix wrappers generated for global 'char' variables to not include a terminating zero byte in the PHP string. 05/03/2006: wsfulton Modify typemaps so that char * can be applied to unsigned char * or signed char * types and visa versa. 05/03/2006: efuzzyone [cffi]Thanks to Luke J Crook for this idea. - a struct/enum/union is replaced with :pointer only if that slot is actually a pointer to that type. So,: struct a_struct { int x; } and struct b_struct { a_struct struct_1; }; will be converted as: (cffi:defcstruct b_struct (struct_1 a_struct)) - Other minor fixes in lispifying names. 05/02/2006: wsfulton Fix possible redefinition of _CRT_SECURE_NO_DEPRECATE for VC++. 04/14/2006: efuzzyone [cffi] Thanks to Thomas Weidner for the patch. - when feature export is set (export 'foo) is generated for every symbol - when feature inline is set (declaim (inline foo)) is generated before every function definition - when feature intern_function is set #.(value-of-intern-function "name" "nodeType" package) is emitted instead of the plain symbol. A sample swig-lispify is provided. - every symbol is prefixed by it's package. 04/13/2006: efuzzyone [cffi] Fixed the generation of wrappers for global variables. Added the option [no]swig-lisp which turns on/off generation of code for swig helper lisp macro, functions, etc. Version 1.3.29 (March 21, 2006) =============================== 04/05/2006: mutandiz [allegrocl] Fix output typemap of char so it produces a character instead of an integer. Also adds input/output typemaps for 'char *'. add command-line argument -isolate to generate an interface file that won't interfere with other SWIG generated files that may be used in the same application. 03/20/2005: mutandiz [allegrocl] More tweaks to INPUT/OUTPUT typemaps for bool. Fix constantWrapper for char and string literals. find-definition keybindings should work in ELI/SLIME. Output (in-package ) to lisp wrapper instead of (in-package #.*swig-module-name*). slight rework of multiple return values. doc updates. 03/17/2005: mutandiz [allegrocl] mangle names of constants generated via constantWrapper. When using OUTPUT typemaps and the function has a non-void return value, it should be first in the values-list, followed by the OUTPUT mapped values. Fix bug with boolean parameters, which needed to be passed in as int values, rather than T or NIL. 03/15/2006: mutandiz [allegrocl] Generate wrappers for constants when in C++ or -cwrap mode. Make -cwrap the default, since it is most correct. Users can use the -nocwrap option to avoid the creation of a .cxx file when interfacing to C code. When in -nocwrap mode, improve the handling of converting infix literals to prefix notation for lisp. This is very basic and not likely to be improved upon since this only applies to the -nocwrap case. Literals we can't figure out will result in a warning and be included in the generated code. validIdentifier now more closely approximates what may be a legal common lisp symbol. Fix typemap error in allegrocl.swg 03/12/2006: mutandiz [allegrocl] fix up INPUT/OUTPUT typemaps for bool. Generate c++ style wrapper functions for struct/union members when -cwrap option specified. 03/10/2006: mutandiz [allegrocl] Fix bug in C wrapper generation introduced by last allegrocl commit. 03/10/2006: wsfulton [Java] Commit #1447337 - Delete LocalRefs at the end of director methods to fix potential leak 03/10/2006: wsfulton Fix #1444949 - configure does not honor --program-prefix. Removed non-standard configure option --with-release-suffix. Fix the autoconf standard options --program-prefix and --program-suffix which were being shown in the help, but were being ignored. Use --program-suffix instead of --with-release-suffix now. 03/10/2006: wsfulton [Java] Fix #1446319 with patch from andreasth - more than one wstring parameter in director methods 03/07/2006: mkoeppe [Guile] Fix for module names containing a "-" in non-"shadow" mode. Patch from Aaron VanDevender (#1441474). 03/04/2006: mmatus - Add -O to the main program, which now enables -fastdispatch [Python] - Add the -fastinit option to enable faster __init__ methods. Setting 'this' as 'self.this.append(this)' in the python code confuses PyLucene. Now the initialization is done in the the C++ side, as reported by Andi and Robin. - Add the -fastquery option to enable faster SWIG_TypeQuery via a python dict cache, as proposed by Andi Vajda - Avoid to call PyObject_GetAttr inside SWIG_Python_GetSwigThis, since this confuses PyLucene, as reported by Andi Vajda. 03/02/2006: wsfulton [Java] Removed extra (void *) cast when casting pointers to and from jlong as this was suppressing gcc's "dereferencing type-punned pointer will break strict-aliasing rules" warning. This warning could be ignored in versions of gcc prior to 4.0, but now the warning is useful as gcc -O2 and higher optimisation levels includes -fstrict-aliasing which generates code that doesn't work with these casts. The assignment is simply never made. Please use -fno-strict-aliasing to both suppress the warning and fix the bad assembly code generated. Note that the warning is only generated by the C compiler, but not the C++ compiler, yet the C++ compiler will also generate broken code. Alternatively use -Wno-strict-aliasing to suppress the warning for gcc-3.x. The typemaps affected are the "in" and "out" typemaps in java.swg and arrays_java.swg. Users ought to fix their own typemaps to do the same. Note that removal of the void * cast simply prevents suppression of the warning for the C compiler and nothing else. Typical change: From: %typemap(in) SWIGTYPE * %{ $1 = *($&1_ltype)(void *)&$input; %} To: %typemap(in) SWIGTYPE * %{ $1 = *($&1_ltype)&$input; %} From: %typemap(out) SWIGTYPE * %{ *($&1_ltype)(void *)&$result = $1; %} To: %typemap(out) SWIGTYPE * %{ *($&1_ltype)&$result = $1; %} 03/02/2006: mkoeppe [Guile -scm] Add typemaps for "long long"; whether the generated code compiles, however, depends on the version and configuration of Guile. 03/02/2006: wsfulton [C#] Add support for inner exceptions. If any of the delegates are called which construct a pending exception and there is already a pending exception, it will create the new exception with the pending exception as an inner exception. 03/02/2006: wsfulton [Php] Added support for Php5 exceptions if compiling against Php5 (patch from Olly Betts). 03/01/2006: mmatus Use the GCC visibility attribute in SWIGEXPORT. Now you can compile (with gcc 3.4 or later) using CFLAGS="-fvisibility=hidden". Check the difference for the 'std_containers.i' python test case: Sizes: 3305432 _std_containers.so 2383992 _std_containers.so.hidden Exported symbols (nm -D .so | wc -l): 6146 _std_containers.so 174 _std_containers.so.hidden Execution times: real 0m0.050s user 0m0.039s sys 0m0.005s _std_containers.so real 0m0.039s user 0m0.026s sys 0m0.007s _std_containers.so.hidden Read http://gcc.gnu.org/wiki/Visibility for more details. 02/27/2006: mutandiz [allegrocl] Add support for INPUT, OUTPUT, and INOUT typemaps. For OUTPUT variables, the lisp wrapper returns multiple values. 02/26/2006: mmatus [Ruby] add argcargv.i library file. Use it as follow: %include argcargv.i %apply (int ARGC, char **ARGV) { (size_t argc, const char **argv) } %inline { int mainApp(size_t argc, const char **argv) { return argc; } } then in the ruby side: args = ["asdf", "asdf2"] n = mainApp(args); This is the similar to the python version Lib/python/argcargv.i 02/24/2006: mgossage Small update Lua documents on troubleshooting problems 02/22/2006: mmatus Fix all the errors reported for 1.3.28. - fix bug #1158178 - fix bug #1060789 - fix bug #1263457 - fix 'const char*&' typemap in the UTL, reported by Geoff Hutchison - fixes for python 2.1 and the runtime library - fix copyctor + template bug #1432125 - fix [ 1432152 ] %rename friend operators in namespace - fix gcc warning reported by R. Bernstein - avoid assert when finding a recursive scope inheritance, emit a warning in the worst case, reported by Nitro - fix premature object deletion reported by Paul in tcl3d - fix warning reported by Nitro in VC7 - more fixes for old Solaris compiler - fix for python 2.3 and gc_refs issue reported by Luigi - fix fastproxy for methods using kwargs - fix overload + protected member issue reported by Colin McDonald - fix seterrormsg as reported by Colin McDonald - fix directors, now the test-suite runs again using -directors - fix for friend operator and Visual studio and bug 1432152 - fix bug #1435090 - fix using + %extend as reported by William - fix bug #1094964 - fix for Py_NotImplemented as reported by Olly and Amaury - fix nested namespace issue reported by Charlie and also: - allow director protected members by default - delete extra new lines in swigmacros[UTL] - cosmetic for generated python code - add the factory.i library for UTL - add swigregister proxy method and move __repr__ to a single global module [python] 02/22/2006: mmatus When using directors, now swig will emit all the virtual protected methods by default. In previous releases, you needed to use the 'dirprot' option to achieve the same. If you want, you can disable the new default behaviour, use the 'nodirprot' option: swig -nodirprot ... and/or the %nodirector feature for specific methods, i.e.: %nodirector Foo::bar; struct Foo { virtual ~Foo(); protected: virtual void bar(); }; As before, pure abstract protected members are allways emitted, independent of the 'dirprot/nodirprot' options. 02/22/2006: mmatus Add the factory.i library for languages using the UTL (python,tcl,ruby,perl). factory.i implements a more natural wrap for factory methods. For example, if you have: ---- geometry.h -------- struct Geometry { enum GeomType{ POINT, CIRCLE }; virtual ~Geometry() {} virtual int draw() = 0; // // Factory method for all the Geometry objects // static Geometry *create(GeomType i); }; struct Point : Geometry { int draw() { return 1; } double width() { return 1.0; } }; struct Circle : Geometry { int draw() { return 2; } double radius() { return 1.5; } }; // // Factory method for all the Geometry objects // Geometry *Geometry::create(GeomType type) { switch (type) { case POINT: return new Point(); case CIRCLE: return new Circle(); default: return 0; } } ---- geometry.h -------- You can use the %factory with the Geometry::create method as follows: %newobject Geometry::create; %factory(Geometry *Geometry::create, Point, Circle); %include "geometry.h" and Geometry::create will return a 'Point' or 'Circle' instance instead of the plain 'Geometry' type. For example, in python: circle = Geometry.create(Geometry.CIRCLE) r = circle.radius() where 'circle' now is a Circle proxy instance. 02/17/2006: mkoeppe [MzScheme] Typemaps for all integral types now accept the full range of integral values, and they signal an error when a value outside the valid range is passed. [Guile] Typemaps for all integral types now signal an error when a value outside the valid range is passed. 02/13/2006: mgossage [Documents] updated the extending documents to give a skeleton swigging code with a few typemaps. [Lua] added an extra typemap for void* [in], so a function which requires a void* can take any kind of pointer Version 1.3.28 (February 12, 2006) ================================== 02/11/2006: mmatus Fix many issues with line counting and error reports. 02/11/2006: mmatus [Python] Better static data member support, if you have struct Foo { static int bar; }; then now is valid to access the static data member, ie: f = Foo() f.bar = 3 just as in C++. 02/11/2006: wsfulton [Perl] Fixed code generation to work again with old versions of Perl (5.004 and later tested) 02/04/2006: mmatus [Python] Add the %extend_smart_pointer() directive to extend SWIG smart pointer support in python. For example, if you have a smart pointer as: template class RCPtr { public: ... RCPtr(Type *p); Type * operator->() const; ... }; you use the %extend_smart_pointer directive as: %extend_smart_pointer(RCPtr); %template(RCPtr_A) RCPtr; then, if you have something like: RCPtr make_ptr(); int foo(A *); you can do the following: a = make_ptr(); b = foo(a); ie, swig will accept a RCPtr object where a 'A *' is expected. Also, when using vectors %extend_smart_pointer(RCPtr); %template(RCPtr_A) RCPtr; %template(vector_A) std::vector >; you can type a = A(); v = vector_A(2) v[0] = a ie, an 'A *' object is accepted, via implicit conversion, where a RCPtr object is expected. Additionally x = v[0] returns (and sets 'x' as) a copy of v[0], making reference counting possible and consistent. %extend_smart_pointer is just a collections of new/old tricks, including %typemaps and the new %implicitconv directive. 02/02/2006: mgossage bugfix #1356577, changed double=>lua_number in a few places. added the std::pair wrapping 01/30/2006: wsfulton std::string and std::wstring member variables and global variables now use %naturalvar by default, meaning they will now be wrapped as expected in all languages. Previously these were wrapped as a pointer rather than a target language string. It is no longer necessary to add the following workaround to wrap these as strings: %apply const std::string & { std::string *} *** POTENTIAL INCOMPATIBILITY *** 01/28/2006: mkoeppe [Guile -scm] Add typemaps for handling of member function pointers. 01/24/2006: mmatus - Better support for the %naturalvar directive, now it works with the scripting languages as well as Java/C#. Now, it can also be applied to class types: %naturalvar std::string; %include that will tell swig to use the 'natural' wrapping mechanism to all std::string global and member variables. - Add support for the %allowexcept feature along the scripting languages, which allows the %exception feature to be applied to the variable access methods. Also, add the %exceptionvar directive to specify a distintic exception mechanism only for variables. - Add more docs for the %delobject directive to mark a method as a destructor, 'disowning' the first argument. For example: %newobject create_foo; %delobject destroy_foo; Foo *create_foo() { return new Foo(); } void destroy_foo(Foo *foo) { delete foo; } or in a member method as: %delobject Foo::destroy; class Foo { public: void destroy() { delete this;} private: ~Foo(); }; 01/24/2006: mgossage [Lua] - Removed the type swig_lua_command_info & replace with luaL_reg (which then broke the code), fixed this - added an additional cast in the typemaps for enum's due to the issue that VC.Net will not allow casting of a double to an enum directly. Therefore cast to int then to enum (thanks to Jason Rego for this observation) 01/16/2006: mmatus (Change disabled... will be back in CVS soon) Add initial support for regexp via the external library RxSpencer. SWIG doesn't require this library to compile and/or run. But if you specify --with-rxspencer, and the library is found during installation, then swig will use it in three places: - In %renames rules, via the new rxsmatch rules, for example: %rename("%(lowercase)",rxsmatch$name="GSL_.*") ""; %rename("%(lowercase)",rxsmatch$nodeType="enum GSL_.*") ""; rxsmatch is similar to the match rule, it just uses the RxSpencer regexp library to decide if there is a match with the provided regexp. As with the match rule, you can also use the negate rule notrxsmatch. - In the %rename target name via the rxstarget option, for example: %rename("%(lowercase)",rxstarget=1) "GSL_.*"; where the target name "GSL.*" is now understood as a regexp to be matched. - In the new encoder "rxspencer", which looks like: %(rxspencer:[regexp][replace])s where "regexp" is the regular expression and "replace" is a string used as a replacement, where the @0,@1,...,@9 pseudo arguments are used to represent the corresponding matching items in the reg expression. For example: %(rxspencer:[GSL.*][@0])s <- Hello -> %(rxspencer:[GSL.*][@0])s <- GSLHello -> GSLHello %(rxspencer:[GSL(.*)][@1])s <- GSLHello -> Hello %(rxspencer:[GSL(.*)][gsl@1])s <- GSLHello -> gslHello Another example could be: %rename("%(lowercase)s",sourcefmt="%(rxspencer:[GSL_(.*)][@1])s",%$isfunction) ""; which take out the prefix "GSL_" and returns all the function names in lower cases, as following: void GSL_Hello(); -> hello(); void GSL_Hi(); -> hi(); const int GSL_MAX; -> GSL_MAX; // no change, is not a function We use the RxSpencer as an initial test bed to implemention while we decide which library will be finally added to swig. You can obtain the RxSpencer library from http://arglist.com/regex (Unix) or http://gnuwin32.sourceforge.net/packages.html (Windows) Once installed, use "man rxspencer" to get more info about the regexp format, or just google rxspencer. Since now you can enable the rxsmatch rules (see above), the simple or '|' support for the match rules (01/12/2006: mmatus) is disabled. Still, if you have problems with the rxspencer library, you can re-enable the simple 'match or' support using -DSWIG_USE_SIMPLE_MATCHOR. 01/16/2006: mmatus Change the %rename predicates to use the prefix '%$', as in: %rename("%(utitle)s",%$isfunction,%$ismember) ""; to avoid clashes with other swig macros/directives. 01/14/2006: cfisavage [Ruby] Added support for Ruby bang! methods via a new %bang feature. Bang methods end in exclamation points and indicate that the object being processed will be modified in-place as opposed to being copied. 01/12/2006: cfisavage [Ruby] Updated the Ruby module to automatically convert method names to lower_case_with_underscores using the new %rename functionality. 01/12/2006: mmatus - Add aliases for 'case' encoders used with %rename/%namewarn %(uppercase)s hello_world -> HELLO_WORLD %(lowercase)s HelloWorld -> helloworld %(camelcase)s hello_world -> HelloWorld %(undercase)s HelloWorld -> hello_world 01/12/2006: mmatus - Add the -dump_parse_module and -dump_parse_top options, which are similar to -dump_module and -dump_top, but they dump the node trees just after parsing, showing only the attributes visible at the parsing stage, and not the added later in typemap.cxx, allocate.cxx, lang.cxx or elsewhere. Besides debugging porpuses, these options are very useful if you plan to use %rename in an "advance way", since it shows only and all the node's attributes you can use inside the match rules. 01/12/2006: mmatus - Add predicates to %rename, so, you don't need to remember, for example, how to match a member function. Now it is easy, for example to use the 'utitle' encoder in all the member methods, you type: %rename("%(utitle)s",%isfunction,%ismember) ""; or to ignore all the enumitems in a given class: %rename("$ignore", %isenumitem, %classname="MyClass") ""; Available predicates are (see swig.swg): %isenum %isenumitem %isaccess %isclass %isextend %isextend %isconstructor %isdestructor %isnamespace %istemplate %isconstant %isunion %isfunction %isvariable %isimmutable %isstatic %isfriend %istypedef %isvirtual %isexplicit %isextern %ismember %isglobal %innamespace %ispublic %isprotected %isprivate %classname These predicates correspond to specific 'match' declarations, which sometimes are not as evident as the predicates names. - Add the or '|' operation in %rename match, for example to capitalize all the constants (%constant or const cdecl): %rename("%(upper)s",match="cdecl|constant",%isimmutable) ""; 01/12/2006: mgossage - Partial fixed of errors under C89, bug #1356574 (converted C++ style comments to C style) - Added patches from neomantra@users.sf.net #1379988 and #1388343 missing a 'return' statement for error conditions also updated the %init block bug #1356586 01/10/2006: mmatus - Add the 'utitle' encoder, as an example of how to add your own encoder. I added the encoder method in misc.c but developers can add others, the same way, inside any target language. Well, 'utitle' is the reverse of 'ctitle', ie: %rename("%(ctitle)s") camel_case; -> CamelCase; %rename("%(utitle)s") CamelCase; -> camel_case; 01/10/2006: cfisavage [Ruby] Updated Ruby Exception handling. Classes that are specified in throws clauses, or are marked as %exceptionclass, are now inherited from rb_eRuntimeError. This allows instances of these classes to be returned to Ruby as exceptions. Thus if a C++ method throws an instance of MyException, the calling Ruby method will get back a MyException object. To see an example, look at ruby/examples/exception_class. 01/10/2006: mmatus - Add the %catches directive, which complements the %exception directive in a more automatic way. For example, if you have int foo() throw(E1); swig generates the proper try/catch code to dispatch E1. But if you have: int barfoo(int i) { if (i == 1) { throw E1(); } else { throw E2(); } return 0; } ie, where there is no explicit exception specification in the decl, you end up doing: %exception barfoo { try { $action } catch(E1) { ... } } catch(E2) { ... } } which is very tedious. Well, the %catches directive defines the list of exceptions to catch, and from swig: %catches(E1,E2) barfoo(int i); int barfoo(int i); is equivalent to int barfoo(int i) throw(E1,E2); Note, however, that the %catches list doesn't have to correspond to the C++ exception specification. For example, if you have: struct E {}; struct E1 : E {}; struct E2 : E {}; int barfoo(int i) throw(E1,E2); you can define %catches(E) barfoo(int i); and swig will generate an action code equivalent to try { $action } catch(E &_e) { ; } Of course, you still have to satisfy the C++ restrictions, and the catches list must be compatible (not the same) as the original list of types in the exception specification. Also, you can now specify that you want to catch the unknown exception '...', for example: %catches(E1,E2,...) barfoo(int); In any case, the %catches directive will emit the code to convert into the target language error/exception using the 'throws' typemap. For the '...' case to work, you need to write the proper typemap in your target language. In the UTL, this looks like: %typemap(throws) (...) { SWIG_exception(SWIG_RuntimeError,"unknown exception"); } 01/09/2006: mutandiz [Allegrocl] Fixes a number of SEGVs primarily in the handling of various anonymous types. Found in a pass through the swig test-suite. Still more to do here, but this is a good checkpoint. Adds -cwrap and -nocwrap as an allegrocl specific command-line argument. Controls generating of a C wrapper file when wrapping C code. By default only a lisp file is created for C code wrapping. Doc updates for the command-line arguments and fixes as pointed out on swig-devel 01/05/2006: wsfulton [Java] Fix unsigned long long and const unsigned long long & typemaps - Bug #1398394 with patch from Dries Decock 01/06/2006: mmatus Add 'named' warning codes, now in addition to: %warnfilter(813); you can use %warnfilter(SWIGWARN_JAVA_MULTIPLE_INHERITANCE); just use the same code name found in Source/Include/swigwarn.h plus the 'SWIG' prefix. If a developer adds a new warning code, the Lib/swigwarn.swg file will be generated when running the top level make. 01/05/2006: cfisavage [Ruby] Reimplemented object tracking for Ruby. The new implementation works by expanding the swig_class structure for Ruby by adding a trackObjects field. This field can be set/unset via %trackobjects as explained in the Ruby documentation. The new implementation is more robust and takes less code to implement. 01/05/2006: wsfulton Fix for %extend and static const integral types, eg: class Foo { public: %extend { static const int bar = 42; } }; 12/30/2005: mmatus - Add info for old and new debug options: -dump_top - Print information of the entire node tree, including system nodes -dump_module - Print information of the module node tree, avoiding system nodes -dump_classes - Print information about the classes found in the interface -dump_typedef - Print information about the types and typedefs found in the interface -dump_tags - Print information about the tags found in the interface -debug_typemap - Print information for debugging typemaps -debug_template - Print information for debugging templates - Add the fakeversion. If you have a project that uses configure/setup.py, or another automatic building system and requires a specific swig version, let say 1.3.22 you can use: SWIG_FEATURES="-fakeversion 1.3.22" or swig -fakeversion 1.3.22 and then swig -version will report 1.3.22 instead of the current version. Typical use would be SWIG_FEATURES="-fakeversion 1.3.22" ./configure 12/30/2005: mmatus - Add option/format support to %rename and %namewarn. Now %namewarn can force renaming, for example: %namewarn("314: import is a keyword",rename="_%s") "import"; and rename can also support format forms: %rename("swig_%s") import; Now, since the format is processed via swig Printf, you can use encoders as follows: %rename("%(title)s") import; -> Import %rename("%(upper)s") import; -> IMPORT %rename("%(lower)s") Import; -> import %rename("%(ctitle)s") camel_case; -> CamelCase This will allow us to add more encoders, as the expected one for regular expressions. - Add the above 'ctitle' encoder, which does the camel case: camel_case -> CamelCase - Also, while we get the regexp support, add the 'command' encoder, you can use it as follows %rename("%(command:sed -e 's/\([a-z]\)/\U\\1/' <<< )s") import; then swig will popen the command "sed -e 's/\([a-z]\)/\U\\1/' <<< import" see below for anonymous renames for better examples. - The rename directive now also allows: - simple match: only apply the rename if a type match happen, for example %rename(%(title)s,match="enumitem") hello; enum Hello { hi, hello -> hi, Hello }; int hello() -> hello; - extended match: only apply the rename if the 'extended attribute' match occurred, for example: // same as simple match %rename(%(title)s,match$nodeType="enumitem") hello; enum Hello { hi, hello -> hi, Hello }; Note that the symbol '$' is used to define the attribute name in a 'recursive' way, for example: // match only hello in 'enum Hello' %rename(%(title)s,match$parentNode$type="enum Hello") hello; enum Hello { hi, hello -> hi, Hello // match }; enum Hi { hi, hello -> hi, hello // no match }; here, for Hello::hi, the "parentNode" is "Hello", and its "type" is "enum Hello". - Anonymous renames: you can use 'anonymous' rename directives, for example: // rename all the enum items in Hello %rename(%(title)s,match$parentNode$type="enum Hello") ""; enum Hello { hi, hello -> Hi, Hello // match both }; enum Hi { hi, hello -> hi, hello // no match }; // rename all the enum items %rename(%(title)s,match$nodeType="enumitem") ""; // rename all the items in given command (sloooow, but...) %rename(%(command:)s) ""; Anonymous renames with commands can be very powerful, since you can 'outsource' all the renaming mechanism (or part of it) to an external program: // Uppercase all (and only) the names that start with 'i' %rename("%(command:awk '/^i/{print toupper($1)}' <<<)s") ""; int imported() -> IMPORTED; int hello() -> hello Note that if the 'command' encoder returns an empty string, swig understands that no rename is necessary. Also note that %rename 'passes' the matched name. For example, in this case namespace ns1 { int foo(); } namespace ns2 { int bar(); } the external program only receives "foo" and "bar". If needed, however, you can request the 'fullname' %rename("%(command:awk 'awk '/ns1::/{l=split($1,a,"::"); print toupper(a[l])}'' <<<)s",fullname=1) ""; ns1::foo -> FOO ns2::bar -> bar - Mixing encoders and matching: of course, you can do mix commands and match fields, for example: %rename("%()",match="cdecl") ""; %rename("%()",match="enumitem") ""; %rename("%()",match="enumitem", match$parentNode$parentNode$nodeType="class") ""; Use "swig -dump_parse_module" to see the attribute names you can use to match a specific case. - 'sourcefmt' and 'targetfmt': sometimes you need to process the 'source' name before comparing, for example %namewarn("314: empty is a keyword",sourcefmt="%(lower)s") "empty"; then if you have int Empty(); // "Empty" is the source you will get the keyword warning since 'Empty' will be lower cased, via the sourcefmt="%(lower)s" option, before been compared to the 'target' "empty". There is an additional 'targetfmt' option to process the 'target' before comparing. - complementing 'match': you can use 'notmatch', for example %namewarn("314: empty is a keyword",sourcefmt="%(lower)s",notmatch="namespace") "empty"; here, the name warning will be applied to all the symbols except namespaces. 12/30/2005: mmatus - Add initial support for gcj and Java -> mechanism. See examples in: Examples/python/java Examples/ruby/java Examples/tcl/java to see how to use gcj+swig to export java classes into python/ruby/tcl. The idea is to put all the common code for gcj inside Lib/gcj and localize specific types such as jstring, as can be found in Lib/python/jstring.i Lib/ruby/jstring.i Lib/tcl/jstring.i Using the UTL, this is very easy, and the perl version for jstring.i will be next. 12/29/2005: mmatus - Add the copyctor feature/directive/option to enable the automatic generation of copy constructors. Use as in: %copyctor A; struct A { }; then this will work a1 = A(); a2 = A(a1); Also, since it is a feature, if you just type %copyctor; that will enable the automatic generation for all the classes. It is also equivalent to swig -copyctor -c++ ... Notes: 1.- The feature only works in C++ mode. 2.- The automatic creation of the copy constructor will usually produce overloading. Hence, if the target language doesn't support overloading, a special name will be used (A_copy). 3.- For the overloading reasons above, it is probably not a good idea to use the flag when, for example, you are using keywords in Python. 4.- The copyctor automatic mechanism follows more or less the same rules as the default constructor mechanism, i.e., a copy constructor will not be added if the class is abstract or if there is a pertinent non-public copy ctor in the class or its hierarchy. Hence, it might be necessary for you to complete the class declaration with the proper non-public copy ctor to avoid a wrong constructor addition. - Fix features/rename for templates ctor/dtor and other things around while adding the copyctor mechanism. 12/27/2005: mmatus - Add the 'match' option to typemaps. Assume you have: %typemap(in) SWIGTYPE * (int res) {..} %typemap(freearg) SWIGTYPE * { if (res$argnum) ...} then if you do %typemap(in) A * {...} swig will 'overload the 'in' typemap, but the 'freearg' typemap will be also applied, even when this is wrong. The old solutions is to write: %typemap(in) A * {...} %typemap(freeag) A * ""; overload 'freearg' with an empty definition. The problem is, however, there is no way to know you need to do that until you start getting broken C++ code, or worse, broken runtime code. The same applies to the infamous 'typecheck' typemap, which always confuses people, since the first thing you do is to just write the 'in' typemap. The 'match' option solves the problem, and if instead you write: %typemap(in) SWIGTYPE * (int res) {..} %typemap(freearg,match="in") SWIGTYPE * { if (res$argnum) ...} %typemap(typecheck,match="in",precedence...) SWIGTYPE * {...} it will tell swig to apply the 'freearg/typecheck' typemaps only if they 'match' the type of the 'in' typemap. The same can be done with other typemaps as: %typemap(directorout) SWIGTYPE * {...} %typemap(directorfree,match="directorout") SWIGTYPE * {...} 12/27/2005: mmatus - Add the 'naturalvar' option/mode/feature to treat member variables in a more natural way, ie, similar to the global variable behavior. You can use it in a global way via the command line swig -naturalvar ... or the module mode option %module(naturalvar=1) both forms make swig treat all the member variables in the same way it treats global variables. Also, you can use it in a case by case approach for specific member variables using the directive form: %naturalvar Bar::s; Then, in the following case for example: std::string s; struct Bar { std::string s; }; you can do: b = Bar() b.s ="hello" cvar.s = "hello" if (b.s != cvar.s): raise RuntimeError This is valid for all the languages, and the implementation is based on forcing the use of the const SWIGTYPE& (C++)/SWIGTYPE (C) typemaps for the get/set methods instead of the SWIGTYPE * typemaps. Hence, for 'naturalvar' to work, each target language must implement 'typemap(in/out) const Type&' properly. The 'naturalvar' option replaces or makes workarounds such as: %apply const std::string & { std::string *} unnecessary. Note1: If your interface has other kinds of workarounds to deal with the old 'unnatural' way to deal with member variables (returning/expecting pointers), the 'naturalvar' option could break them. Note2: the option has no effect on unnamed types, such as unnamed nested unions. 12/27/2005: mmatus - Add more 'expressive' result states for the typemap libraries. In the past, for scripting languages, you would do checking something like: if (ConvertPtr(obj,&vptr,ty,flags) != -1) { // success } else { // error } Now the result state can carry more information, including: - Error state: like the old -1/0, but with error codes from swigerrors.swg. int res = ConvertPtr(obj,&vptr,ty,flags); if (SWIG_IsOK(res)) { // success code } else { SWIG_Error(res); // res carries the error code } - Cast rank: when returning a simple successful conversion, you just return SWIG_OK, but if you need to do a 'cast', you can add the casting rank, ie: if (PyFloat_Check(obj)) { value = PyFloat_AsDouble(obj); return SWIG_OK; } else if (PyInt_Check(obj)) { value = (double) PyInt_AsLong(obj); return SWIG_AddCast(SWIG_OK); } later, the casting rank is used to properly dispatch the overloaded function, for example. This of course requires your language to support and use the new dispatch cast/rank mechanism (Now mainly supported in perl and python, and easily expandable to ruby and tcl). - [UTL] Add support for the new 'expressive' result states. 12/27/2005: mmatus - Add support for the C++ implicit conversion mechanism, which required some modifications in parser.y (to recognize 'explicit') and overload.cxx (to replace $implicitconv as needed). Still, real support in each target language requires each target language to be modified. Python provides an example, see below. - Add support for native C++ implicit conversions, ie, if you have %implicitconv A; struct A { int ii; A() {ii = 1;} A(int) {ii = 2;} A(double) {ii = 3;} explicit A(char *s) {ii = 4;} }; int get(const A& a) {return a.ii;} you can call: a = A() ai = A(1) ad = A(1.0) as = A("hello") # old forms get(a) -> 1 get(ai) -> 2 get(ad) -> 3 get(as) -> 4 #implicit conversions get(1) -> 2 get(1.0) -> 3 get("hello") -> Error, explicit constructor Also, as in C++, now implicit conversions are supported in variable assigments, and if you have: A ga; struct Bar { A a; }; you can do: cvar.ga = A(1) cvar.ga = 1 cvar.ga = 1.0 cvar.ga = A("hello") cvar.ga = "hello" -> error, explicit constructor b = Bar() b.a = A("hello") b.a = 1 b.a = 1.0 b.a = "hello" -> error, explicit constructor Note that the last case, assigning a member var directly, also requires the 'naturalvar' option. This support now makes the old '%implicit' macro, which was found in 'implicit.i' and it was fragile in many ways, obsolete, and you should use the new '%implicitconv' directive instead. Note that we follow the C++ conventions, ie, in the following the implicit conversion is allowed: int get(A a) {return a.ii;} int get(const A& a) {return a.ii;} but not in these cases: int get(A *a) {return a->ii;} int get(A& a) {return a.ii;} Also, it works for director methods that return a by value result, ie, the following will work: virtual A get_a() = 0; def get_a(self): return 1 but not in this case: virtual const A& get_a() = 0; virtual A& get_a() = 0; virtual A* get_a() = 0; Notes: - the implicitconv mechanism is implemented by directly calling/dispatching the python constructor, triggering a call to the __init__method. Hence, if you expanded the __init__ method, like in: class A: def __init__(self,args): then 'my code' will also be executed. - Since the %implicitconv directive is a SWIG feature, if you type: %implicitconv; that will enable implicit conversion for all the classes in your module. But if you are worried about performance, maybe that will be too much, especially if you have overloaded methods, since to resolve the dispatching problem, python will efectively try to call all the implicit constructors as needed. - For the same reason, it is highly recommended that you use the new 'castmode' when mixing implicit conversion and overloading. - [python] The %implicit directive is declared obsolete, and you should use %implicitconv instead. If you include the implicit.i file, a warning will remind you of this. Note: Since %implicit is fragile, just replacing it by %implicitconv could lead to different behavior. Hence, we don't automatically switch from to the other, and the user must migrate to the new %implicitconv directive manually. 12/26/2005: wsfulton [C#] Modify std::vector wrappers to use std::vector::value_type as this is closer to the real STL declarations for some methods, eg for push_back(). Fixes some compilation errors for some compilers eg when the templated type is a pointer. [Java] std::vector improvements - a few more methods are wrapped and specializations are no longer required. The specialize_std_vector macro is no longer needed (a warning is issued if an attempt is made to use it). 12/26/2005: wsfulton [Java, C#] Add in pointer reference typemaps. This also enables one to easily wrap std::vector where T is a pointer. 12/24/2005: efuzzyone [CFFI] The cffi module for SWIG: - Fully supports C, but provides limited supports for C++, in particular C++ support for templates and overloading needs to be worked upon. 12/23/2005: mmatus [python] Add the castmode that allows the python type casting to occur. For example, if you have 'int foo(int)', now class Ai(): def __init__(self,x): self.x = x def __int__(self): return self.x foo(1) // Ok foo(1.0) // Ok foo(1.3) // Error a = Ai(4) foo(ai) // Ok The castmode, which can be enabled either with the '-castmode' option or the %module("castmode") option, uses the new cast/rank dispatch mechanism. Hence, now if you have 'int foo(int); int foo(double);', the following works as expected: foo(1) -> foo(int) foo(1.0) -> foo(double) ai = Ai(4) foo(ai) -> foo(int) Note1: the 'castmode' could disrupt some specialized typemaps. In particular, the "implicit.i" library seems to have problem with the castmode. But besides that one, the entire test-suite compiles fine with and without the castmode. Note2: the cast mode can't be combined with the fast dispatch mode, ie, the -fastdispatch option has no effect when the cast mode is selected. The penalties, however, are minimum since the cast dispatch code is already based on the same fast dispatch mechanism. See the file overload_dispatch_cast_runme.py file for new cases and examples. 12/22/2005: mmatus Add the cast and rank mechanism to dispatch overloading functions. The UTF supports it now, but for each language it must be decided how to implement and/or when to use it. [perl] Now perl uses the new cast and rank dispatch mechanism, which solves all the past problems known in perl, such as the old '+ 1' problem: int foo(int); $n = 1 $n = $n + 1 $r = foo(n) also works: foo(1); foo("1"); foo(1.0); foo("1.0"); but fails foo("l"); and when overloading foo(int) and foo(double); foo(1) -> foo(int) foo(1.0) -> foo(double) foo("1") -> foo(int) foo("1.0") -> foo(double) foo("l") -> error foo($n) -> foo(int) for good perl versions foo($n) -> foo(double) for old bad perl versions when overloading foo(int), foo(char*) and foo(double): foo(1) -> foo(int) foo(1.0) -> foo(double) foo("1") -> foo(char*) foo("1.0") -> foo(char*) foo("l") -> foo(char*) Note: In perl the old dispatch mechanism was broken, so, we don't provide an option to enable the old one since, again, it was really really broken. See 'overload_simple_runme.pl' for more cases and tests. PS: all the old known issues are declared resolved, any new "problem" that could be discovered is declared, a priori, as "features" of the new dispatch mechanism (until we find another solution at least). *** POTENTIAL INCOMPATIBILITY *** As with the introduction of the UTF, some things could now start to work as expected, and people used to deal or workaround previous bugs related to the dispatch mechanism, could see now a difference in perl behavior. 12/21/2005: mmatus - The '-nodefault' flag (pragma and feature) now generates a warning, and recommends to use the explicit -nodefaultctor and -nodefaultdtor options. The reason to split the 'nodefault' behavior is that, in general, ignoring the default destructor generates memory leaks in the target language. Hence, is too risky just to disable both the default constructor and destructor at the same time. If you need to disable the default destructor, it is also recommended you use the directive form: %nodefaultdtor MyVerySpecialClass; for specific classes, and always avoid using the global -nodefault and -nodefaultdtor options. 12/21/2005: wsfulton [Java, C#] Fix incorrect code generation when the intermediary classname is changed in the module directive from its default. For example: %module(jniclassname="myimclassnewname") "mymodule" // Java %module(imclassname="myimclassnewname") "mymodule" // C# Add in new special variable $imclassname. See docs. 12/17/2005: mmatus [Python] - Add the -aliasobj0/-noaliasobj0 options to use with -fastunpack and/or -O and old typemaps that use 'obj0' directly. So, if you compile your code using -O and get errors about the undeclared 'obj0' variable, run again using swig -O -aliasobj0 -python .... For new typemaps, never use 'obj0' directly, if needed, use the '$self' name that will be properly expanded to 'obj0' (nofastunpack) or 'swig_obj[0]' (fastunpack). If you have no idea what I am talking about, better, that means you have no typemap with this problem. 12/14/2005: mmatus [Python] - Add the -fastunpack/-nofastunpack options to enable/disable the use of the internal UnpackTuple method, instead of calling the one from the python C API. The option -O now also implies -fastunpack. 12/11/2005: mmatus [Python] - Add the -proxydel/-noproxydel options to enable/disable the generation of proxy/shadow __del__ methods, even when now they are redundant, since they are empty. However, old interfaces could rely on calling them. The default behavior is to generate the __del__ methods as in 1.3.27 or older swig versions. The option -O now also implies -noproxydel. 12/10/2005: mmatus [UTF] - Fix unnecessary calls to SWIG_TypeQuery for 'char *' and 'wchar_t *', problem found by Clay Culver while profiling the PyOgre project. [Python] - Add the -dirvtable/-nodirvtable to enable/disable a pseudo virtual table used for directors, avoiding the need to resolve the python method at each call. - Add the -safecstrings/-nosafecstrings options to enable/disable the use of safe conversions from PyString to char *. Python requires you to never change the internal buffer directly, and hence 'safectrings' warranties that but returning a copy of the internal python string buffer. The default, as in previous releases, is to return a pointer to the buffer (nosafecstrings), so, it is the user's responsibility to avoid its modification. - Add the -O option to enable all the optimization options at once, initially equivalent to -modern -fastdispatch -dirvtable -nosafecstrings -fvirtual 12/08/2005: mmatus - Add the -fastdispatch option (fastdispatch feature). This enables the "fast dispatch" mechanism for overloaded methods provided by Salvador Fandi~no Garc'ia (#930586). The resulting code is smaller and faster since less type checking is performed. However, the error messages you get when the overloading is not resolved could be different from what the traditional method returns. With the old method you always get an error such as "No matching function for overloaded ..." with the new method you can also get errors such as "Type error in argument 1 of type ..." See bug report #930586 for more details. So, this optimization must be explicitly enabled by users. The new mechanism can be used as: swig -fastdispatch or using the feature form %feature("fastdispatch") method; or %fastdispatch method; 12/06/2005: mmatus - Several memory and speed improvements, specially for templates. Now swig is up to 20 faster than before for large template interfaces, such as the std_containers.i and template_matrix.i files in the python test-suite. Memory footprint is also reduced in consideration of small pcs/architectures. - add commandline options -cpperraswarn and -nocpperraswarn" to force the swig preprocessor to treat the #error directive as a #warning. the pragmas #pragma SWIG cpperraswarn=1 #pragma SWIG cpperraswarn=0 are equivalent to the command line options, respectively. 12/06/2005: mmatus [Python] The generated code is now more portable, especially for Windows. Following http://www.python.org/doc/faq/windows.html Py_None is never accessed as a structure, plus other tricks mentioned there. 12/06/2005: mmatus [Python] Added initial support for threads based in the proposal by Joseph Winston. The user interface is as follows: 1.- the module thread support is enable via the "threads" module option, i.e. %module("threads"=1) 2.- Equivalent to that, is the new '-threads' swig option swig -threads -python ... 3.- You can partially disable thread support for a given method using: %feature("nothread") method; or %nothread method; also, you can disable sections of the thread support, for example %feature("nothreadblock") method; or %nothreadblock method; %feature("nothreadallow") method; or %nothreadallow method; the first disables the C++/python thread protection, and the second disables the python/C++ thread protection. 4.- The current thread support is based in the PyGIL extension present in python version 2.3 or later, but you can provide the thread code for older versions by defining the macros in pythreads.swg. If you get a working implementation for older versions, please send us a patch. For the curious about performance, here are some numbers for the profiletest.i test, which is used to check the speed of the wrapped code: nothread 9.6s (no thread code) nothreadblock 12.2s (only 'allow' code) nothreadallow 13.6s (only 'block' code) full thread 15.5s ('allow' + 'block' code) i.e., full thread code decreases the wrapping performance by around 60%. If that is important to your application, you can tune each method using the different 'nothread', 'nothreadblock' or 'nothreadallow' features as needed. Note that for some methods deactivating the 'thread block' or 'thread allow' code is not an option, so, be careful. 11/26/2005: wsfulton SWIG library files use system angle brackets everywhere for %include, eg %include "std_common.i" becomes %include 11/26/2005: wsfulton [Java, C#] Typesafe enums and proper enums have an extra constructor so that enum item values that are initialised by another enum item value can be wrapped without having to use %javaconstvalue/ %csconstvalue for when using %javaconst(1)/%csconst(1). Suggestion by Bob Marinier/Douglas Pearson. For example: typedef enum { xyz, last = xyz } repeat; 11/21/2005: mmatus [ruby + python] Fixes for directors + pointers. This is an ugly problem without an easy solution. Before we identified this case as problematic: virtual const MyClass& my_method(); but it turns out that all the cases where a pointer, array or reference is returned, are problematic, even for primitive types (as int, double, char*, etc). To try to fix the issue, a new typemap was added, 'directorfree', which is used to 'free' the resources allocated during the 'directorout' phase. At the same time, a primitive garbage collector engine was added to deal with orphaned addresses, when needed. The situation is much better now, but still it is possible to have memory exhaustation if recursion is used. So, still you need to avoid returning pointers, arrays or references when using director methods. - Added stdint.i - typemaps for latest C99 integral types found in stdint.h. 11/14/2005: wsfulton More types added to windows.i, eg UINT8, WORD, BYTE etc. Including windows.i will also enable SWIG to parse the __declspec Microsoft extension, eg __declspec(dllimport). Also other Windows calling conventions such as __stdcall. 11/10/2005: wsfulton New library file for Windows - windows.i. This file will contain useful type information for users who include windows.h. Initial support is for the non ISO integral types: __int8, __int16, __int32, __int64 and unsigned versions. The unsigned versions previously could not be parsed by SWIG. SF #872013. 11/09/2005: wsfulton [Java, C#] Portability warning for files which will overwrite each other on case insensitive file systems such as FAT32/NTFS. This will occur, for example, when two class names are the same barring case. The warning is issued on all platforms and can be suppressed with the usual warning suppression techniques. SF bug #1084507. 11/09/2005: wsfulton ./configure --with-python --with-ruby --with-perl5 etc enable these languages, ie the --with-xxxx options, where no path is specified, work the same as if the option was not specified at all. Based on patches #1335042 #1329048 #1329047. 11/09/2005: dancy [Allegrocl] Add C++ support to the Allegrocl module. Further enhances the C support as well. Some of the features: - MUCH better generation of foreign types based on the C/C++ types for use in defining the FFI on the lisp side. We don't pass everything as a (* :void) any longer. - Uses typemaps for better control of type conversions and code generation in the generated lisp and c++ wrapper code. - CLOS wrapping of pointers returned from foreign space makes it easier to differentiate pointers in user code. The wrapping objects can be passed directly to FF calls. - Defun wrapping of FF calls, allowing for more lispy interface. Conversion, GCing, of lisp objects to foreign objects can be done in the wrapping defun via the use of typemaps. - overload dispatching implemented on the lisp side using generic functions. - Templates and synonymous types supported. 11/07/2005: mmatus [Python] Adding proper support for multi-inheritance in the python side, ie, if you have two C++ wrapped class, Foo and Bar, now: class MyPythonClass(Foo,Bar): .... will properly work, even with directors, and the deallocation of Foo.this and Bar.this will follow correctly. Before, a class could only have one 'this' instance (unlike C++), only the last base class was properly deleted, or detected with directors. Now 'self.this' can be a list, which will contain the C++ instance pointers for all the base classes. Also, swig.this is responsible for deallocating the C++ instance(s), and the __del__ method is not emitted unless the user preppend/append some code to it. - Swig can now detect memory leaks, ie, if you still don't use proxy/shadow classes, and type something like import _example f = _example.new_Foo() and forget to call _example.delete_Foo(f), then swig will tell you that there is a memory leak. Otherwise, if you always use the proxy classes, you probably you will never ever see this warning unless there is something wrong inside the swig wrapping code. *** POTENTIAL INCOMPATIBILITY *** If you overloaded the __del__ method, and call the base one without a try block, as in class MyClass(SwigClass): def __del__(self): SwigClass.__del__(self) python could complain that the method SwigClass.__del__ is undefined. Try to use instead: def __del__(self): try: SwigClass.__del__(self) except: pass or simply def __del__(self): 11/02/2005: mmatus [Python] Adding more fun to STL/STD containers, now you can do %template(pyset) std::set; %template(pyvector) std::vector; %template() std::pair; %template(pyvector) std::map; .... The same applies to std::list, std::deque, std::multiset, etc. Then, at the python side you can do now: # C++ std::vector as native python sequence v = pyvector([1,"hello",(1,2)]) print v[1] >> 'hello' print v[2] >> (1,2) # C++ std::set as native python sequence s = pyset() s.insert((1,2)) s.insert(1) s.insert("hello") sum=() for i in s: sum +=(i,) print sum >>> (1, 'hello', (1, 2)) # C++ std::map as native python sequence m = pymap() m["foo"] = "hello" m[1] = (1,2) pm = {} for k in m: pm[k] = m[k] print pm >>> {1: (1, 2), 'foo': 'hello'} ie, the STD/STL containers work as real native python container, with arbitrary item types and so. But since normal C++ containers do not properly ref/unref their items, you should use the safer versions: %template(pyset) std::set; %template(pyvector) std::vector; %template() std::pair; %template(pyvector) std::map; .... where swig::PyObject_ptr is a PyObject * envelope class provided to safely incref/decref the python object. So, now you can use all the STL/STD containers as native Python containers. Note 1: std::map, std::set and the other 'ordered' containers will properly use PyObject_Compare for sorting, when needed. Note 2: all the STL/STD containers have a limit size of SIZE_MAX, ie, you can have manage containers larger than INT_MAX, the python limit. 11/02/2005: mmatus [Python] - add 'iterator()' method for all sequences and additionally 'key_iterator()' for maps. 'iterator()' will always return the native C++ iterator. Additionally, in maps, 'key_iterator()' will return a python iterator using only the map keys. In general the sequence method __iter__ will call 'iterator()', returning the native C++ iterator, but in maps it will call 'key_iterator()', maintaining backward compatibility. Hence, for std::maps, you can play then with the native C++ iterator, which value is a (key, value) pair, by calling map.iterator(), as with map.begin(), map.end(), etc. The difference is that map.iterator() returns a safe 'closed' iterator, while map.begin() and map.end() are 'open' iterators. A 'closed' iterator knows the begin and the end of the sequence, and it never can seg. fault. An 'open' iterator, as in C++, can seg. fault at the C++ side. # a closed iterator is safe in the following example. # the next() method will throw a StopIteration # exception as needed i = seq.iterator() try: while True: sum += i.next() except: pass # an open iterator always need to be checked, # or it will crash at the C++ side current = seq.begin() end = seq.end() while (current != end): sum += current.next() [Python] - Finally, when we call f = Foo() the construction is 'one-way'. Before construction was done something like Foo() (python) -> _new_Foo() (C++) new_Foo() (C++) -> FooPtr() (python) FooPtr() (python) -> Foo() (python) and returning a pointer was done like NewPointerObj() (C++) -> FooPtr() (python) FooPtr(python) -> Foo() (python) ie, we when going back and forward between the C++ and python side. Now since there is no FooPtr the construction process is Foo() (python) -> _new_Foo() (C++) _new_Foo() (C++) -> NewPointerObj() (C++) (no shadow class) and returning a pointer is done NewPointerObj() (C++) (with shadow class) -> NewInstaceObj() (C++) where NewInstanceObj creates a new instance without calling __init__ and it doesn't go 'back' to python, is 'pure' C API. - With this change, and the other ones in the PySwigObject type, which now carries the thisown and swig_type_info pointer, the generated code should be as fast as boost::Python and/or the other python wrappers based in pure Python/C API calls. As a reference, the profiletest_runme.py example, which does a simple call function many times, such as this code: import profiletest a = profiletest.A() b = profiletest.B() for i in range(0,1000000) a = b.fn(a) where fn is defined as 'A* B::fn(A *a) {return a;}', produces the following times nomodern modern swig-1.3.26 19.70s 5.98s swig-CVS 0.99s 0.98s Clearly, there is a large improvement for the python 'nomodern' mode. Still, the 'modern' mode is around 6 times faster than before. For the same test, but using the non-shadow version of the module, we get _profiletest (non-shadow) swig-1.3.26 0.80s swig-CVS 0.60s Hence, now for practical purposes, the proxy overhead is insignificant. Note that the performance numbers we are showing is for a simple module (two types) and a simple function (one argument). For real situations, for modules with many more types and/or functions with many more parameters, you will see even better results. 10/31/2005: mmatus [Python] - Finally, no more ClassPtr proxy classes. You will see only a clean Class proxy class in the .py file. - No more 'real' thisown attribute either, the PySwigObject now carries the ownership info. You can also do something like print self.this.own() >>> True self.this.disown() self.this.own(0) print self.this.own() >>> False self.this.acquire() self.this.own(1) print self.this.own() >>> True Still the old way, print self.thisown >>> True self.thisown = 0 print self.thisown >>> False self.thisown = 1 print self.thisown >>> True is supported, and python dispatches the proper method calls as needed. - Support for iterators in STL/STD containers, for example, if you have %template std::set; you can use the C++ iterators as: s = set_string() s.append("c") s.append("a") s.append("b") b = s.begin() e = s.end() sum = "" while (b != e): sum += b.next() print sum >>> "abc" advance the iterator as in C++ current = s.begin() current += 1 print current.value() >>> "b" now using the reverse operators b = s.rbegin() e = s.rend() sum = "" while (b != e): sum += b.next() print sum >>> "cba" or the 'previous' method b = s.begin() e = s.end() sum = "" while (b != e): sum += e.previous() print sum >>> "cba" or just as in a python fashion for i in s: sum += i Note 1: Iterators in C++ are very powerful, but dangerous too. And in python you can shoot yourself in the foot just like in C++, so, be careful. Note 2: the iterators are 'light', ie, they do not convert sequence elements until you request to do so, via next(), value() or previous(). If you just increment/decrement one no conversion is performed, for example: b = s.begin() b += 1 b.incr() b.incr(2) b.decr(2) b.decr() b -= 1 only the iterator is modified, and not value wrapper is generated. Other typical C++ operations are also available, such as: print s.end() - s.begin() >>> 3 f = s.begin() + 1 print f.value() >>> "b" l = s.end() - 1 print l.value() >>> "c" etc. Of course, the 'find', 'insert', 'erase', and so on methods also supports iterators now, ie: i = s.begin() i += 1 s.erase(i) for i in s: sum += i print sum >>> "ac" *** POTENTIAL INCOMPATIBILITY *** There is no more 'thisown' attribute. If you use it, python will translate the following code as follows: if (self.thisown): ==> if (self.this.own()): self.thisown = 1 ==> self.this.own(1) self.thisown = 0 ==> self.this.own(0) Still, maybe in some unusual cases the translation will not be 100% correct, so if you have a problem, please report it and/or use the new 'self.this.own()' accessor. *** POTENTIAL INCOMPATIBILITY *** There is no more ClassPtr classes in the python code. Hence, if in the past you needed to resort to some kind of trickery with them, or overcome their presence, it is no longer required, but the extra code you added could now break things. If needed, you can use the option -classptr, i.e., swig -classptr -python ... to generate the old ClassPtr classes. 10/30/2005: mkoeppe [Guile] Make declared and defined linkage of SWIG_init consistent. Reported by Steven G. Johnson (SF patch 1315498). 10/26/2005: mmatus - Added the attribute.i file to the global library director. Now it can be used from other languages that do not use the unified typemap library as well. So, if you have something like: %include attribute.i %attribute(A, int, a, get_a, set_a); struct A { int get_a() const; void set_a(int aa); }; %attribute_ref(B, int, c); struct B { int& c(); }; then in the target language the 'A.a' and 'B.c' attributes will be visible, ie, you can access them as plain variables: f = A() f.a = 3 g = B() g.c = 3 h = f.a + g.c and the proper get/set methods will be dispatched. See attribute.i for more info. - More cleanups around and adding more test-cases. The DISOWN typemap now is tested and working in all the languages that use the unified typemap library, ie, tcl, ruby, perl and python. 10/25/2005: mmatus - Perl, complete the DISOWN typemap. - added the attribute.i file to the unified typemap library (before was only usable from python). - unify the names for the setter and getter methods in perl,tcl,ruby and python, so, the attribute.i library can work across them. - see the li_attribute.i test-case or the library file Lib/typemaps/attribute.swg for more info about how to use it. 10/24/2005: mmatus - Perl now uses the unified typemap library. - Changes in ruby to use the $track option in typemaps. - Changes in the unified typemap library to follow the convention that all macros that are not used in the C/C++ side starts with %, such as %delete %new_array etc. - Documenting fragments, see fragments.swg. - Cleaner way to use the unified typemap library, include just . Check some of the supported languages: perl, tcl, ruby, python. Always start with the head file, such as python/python.swg tcl/tcl8.swg ruby/ruby.swg perl5/perl5.swg and the principal file that invokes the unified library, such as python/pytypemaps.swg tcl/tcltypemaps.swg ruby/rubytypemaps.swg perl/perltypemaps.swg The file that provide the specialization for each language are the one that provides the basic types: python/pyprimtypes.swg ruby/rubyprimtypes.swg tcl/tclprimtypes.swg perl5/perlprimtypes.swg and the string manipulation: python/pystrings.swg ruby/rubystrings.swg tcl/tclstrings.swg perl5/perlstrings.swg The rest of the files, such as carray.i, are mostly one line files that include the proper typemap library version. *** POTENTIAL INCOMPATIBILITY in Perl *** Some missing/wrong typemaps could start working properly, and change the old expected behavior in Perl. 10/23/2005: wuzzeb Chicken: + pointers to member functions finally work properly + add test of member function pointers to cpp_basic.i 10/20/2005: dancy [allegrocl] Added C++ support. Large update, many changes. See newly added Allegro Common Lisp section in lisp.html 10/20/2005: mmatus Ruby, Tcl, Python: - Uniform way to fail (label fail:), now finally SWIG_exception works across the three languages and all the typemaps. - Add proper cleanup code to ruby - More valgrind fixes - Simplify the inline use, it seems a small interface of 20,000 lines (plus many many templates) can break gcc -O3 easily. - Finalize the typemaps library. All the old *.i files (carray.i, cpointer.i, exception.i) had been implemented in the new typemaps library. 10/19/2005: wuzzeb Update the Runtime Typemap documentation in Typemaps.html 10/18/2005: wuzzeb Chicken: - Correctly handle %ignored classes - Correctly convert long, long long, unsigned long, etc to chicken primitives. (Thanks to Felix Winkelmann) - Using argout parameters when the return value was a wrapped pointer caused a memory corruption. The chicken garbage collector moved a pointer out from under us. This is now fixed by running all the proxy creation functions as continuations after the wrapper function returns. As part of this, we no longer need the chickenfastproxy flag on output typemaps. - using -proxy and -nocollection together works now Before, it was not exporting the destructor in the proxy wrapper. 10/18/2005: mmatus Added the Unified Typemap Library (UTL). It unifies the typemaps for python, ruby, tcl and in the process, fixes several problems in each of the three languages to work in a "canonical" way now established in the typemap library SWIG/Lib/typempas The current status of the unification is that everything compiles and runs inside the test-suite and examples directories. And for the first time we have three languages than pass the primitive_types.i case. Also, we have a uniform way to treat the errors, for example if you do something like >>> from primitive_types import * >>> print val_uchar(10) 10 >>> print val_uchar(1000) Traceback (most recent call last): File "", line 1, in ? OverflowError: in argument 1 of type 'unsigned char' you get the same exception in all the three languages. And well, many more good things will come from this unification, for example, proper support of the STL/STD classes for all the languages, and hopefully, we can keep adding other languages. The hardest part, writing a common typemap library that suites the three different languages, is done, and adding another language should now be easy. Still the global unification is not complete, the STL/STD part is next, and probably as well as adding one or two more languages. If you are curious, look at the python, ruby and/or tcl directories to see what is needed to support the new common typemaps library. Still, the final way to integrate a new language could change as we move to integrate the STD/STL. *** POTENTIAL INCOMPATIBILITY in Ruby/Tcl *** Some missing/wrong typemaps could start working properly, and change the old behavior, specially in ruby and tcl. Version 1.3.27 (October 15, 2005) ================================= 10/15/2005: wsfulton [Java] Fix for typesafe enum wrapping so that it is possible to overload a method with 2 different enum types. 10/15/2005: wsfulton Fix for %feature("immutable","0") attempting to generate setters for constants. Restored %immutable and %makedefault to clear the feature as it behaved in SWIG-1.3.25 and earlier. 10/14/2005: mmatus Fix bug in anonymous typedef structures which was leading to strange behaviour. 10/13/2005: mmatus Several minor changes: - Improve the wchar_t type support - Add a warning for when you define the 'in' typemap but you don't define the 'typecheck' one. Very common mistake. - Add proper default rule for function pointers, now you can define a typemap such as: %typemap(in) SWIGTYPE ((*)(ANY)) {...} That will apply to all the pointer to functions. The rule in C++ also apply to the function 'reference', ie, in both cases typedef int (*fptr)(int a); typedef int (func)(int a); This was needed since it seems to be 'illegal' in C++ to do something like: void *ptr = static_cast(fptr); and probably, as for member functions, it is not warrantied that the pointer sizes will match. - Add the #error/#warning directives to swig's cpp. - Add the noblock option for typemaps, which is used as follows: supposed you a typemap, like this %typemap(in,noblock=1) Hello { .... } then the typemap will be inserted without the block imposed by the brackets, similar to %typemap(in) Hello "..."; So, why you don't just use the quote style?, because: 1.- The quote style doesn't get preprocessed, for example %typemap(in) Hello "$1= SWIG_macro($1);"; here, SWIG_macro doesn't get expanded 2.- Inside a quote typemap, you have to use quotes carefully %typemap(in) Hello "$1 = \"hello\" "; 3.- You can't make emacs and/or other editors to indent inside a string!. So, why do you want to remove the block?, because an extra block when not needed (no local variables in it): 1.- makes the code harder to read 2.- makes the code larger 3.- or in short, for the same reason we have the quote style. Version 1.3.26 (October 9, 2005) ================================ 10/08/2005: wsfulton [Php] Added 'throws' typemaps. 10/08/2005: wsfulton Fixes for languages that don't support multiple inheritance. The first non-ignored class in the public base class list is used for inheritance. by the proxy class. Previously, if the first class in the list was ignored, then the proxy class wouldn't have any base classes. 10/07/2005: mmatus Update more features to follow new convention, including: callback ref/unref except All of them use not only the feature as a flag, but also as code value. To deal with those features, we use now GetFlagAttr, which is similar to GetFlag, but instead or returning 1 or 0, it returns the attr value, if happens to be different of "0" of course. Now there are also more uniform directive names for the ones based in features, for example, for the old %newobject directive now we have tree directives defined: #define %newobject %feature("new") #define %nonewobject %feature("new","0") #define %clearnewobject %feature("new","") and so on for all the other feature directives. *** POTENTIAL INCOMPATIBILITY *** 09/30/2005: wsfulton Subtle change to some features. Previously it was not possible to disable many features once they had been enabled. This was for most features that behave as flags. These features now work as follows: %feature("name") // enables the feature %feature("name", "1") // enables the feature %feature("name", "0") // disables the feature %feature("name", "") // clears the feature In fact any non-empty value other than "0" will enable the feature (like C boolean logic). Previously "1", "0" or any other non-empty value would enable the feature and it would only be possible to disable the feature by clearing it (assuming there was no global enable). The following features are affected: allowexcept compactdefaultargs classic (Python) cs:const (C#) director exceptionclass (Python) ignore immutable java:const (Java) java:downcast (Java) kwargs modern (Python) new noautodoc (Python) nodefault nodirector noref notabstract nounref novaluewrapper python:maybecall (Python) python:nondynamic (Python) modula3:multiretval (Modula3) predicate (Ruby) trackobjects (Ruby) valuewrapper It is now possible, for example to ignore all methods/classes in a header file, except for a few targetted methods, for example: %feature("ignore"); // ignore all methods/classes %feature("ignore","0") some_function(int, double); // do not ignore this function %feature("ignore","0") SomeClass; // do not ignore this Class %feature("ignore","0") SomeClass::method; // do not ignore this method %include "bigheader.h" Removed %pythondynamic - it never worked properly. Use %pythonnondynamic instead. Removed %feature("nokwargs") - it wasn't fully implemented - use %feature("kwargs","0") instead. *** POTENTIAL INCOMPATIBILITY *** 09/25/2005: mkoeppe [Guile] Add "throws" typemaps. 09/24/2005: cfisavage [Ruby] Adds new %trackobjects functionality that maps C++ objects to Ruby objects. This functionality makes it much easier to implement mark functions for the garbage collector. For more information refer to the update documentation and examples. 09/20/2005: wsfulton [Perl] Patch 1116431 from Josh Cherry. Fixes non member functions inadvertently being called instead of member functions. 09/20/2005: wsfulton [Lua] Patch from Mark Gossage to add support for Lua-5.1, std::string, std::vector, std::exception and documentation. 09/14/2005: mmatus [Python] Add -nocppcast. Now the default behavior is to always use the cppcast operators. Before that was the case only when you used the -cppcast option. If this seems to break your code... your welcome!, it means it was broken before, and you never notice. If you thing the error is due to one of the SWIG typemaps, send us an example. Use -nocppcast only with very old C++ compilers that do not support the cppcast operations. So, here applies: This change doesn't break compatibility, it was broken before. 09/13/2005: wsfulton [Java] Fix for director methods when a class is passed by value as a parameter. 09/11/2005: mmatus Adding the module option to the %import directive. Now you can use it as %import(module="BigModule") foo.i where subfile could (or not) define the module name via the %module directive. The module option take precedence and it has the same effects than having the directive %module BigModule inside the imported file foo.i. You can use the option in mainly two cases: 1.- You used the -module option when you generated the module to be imported, and hence the module name in the imported %module directive is not really useful. 2.- The module you want to import is very large, and it has several .i/.h files. Then, if you just one to import a class or so from the module, says 'foo', and not the entire module via importing the main BigModule.i file, then you just do: %import(module="BigModule") foo.h or %import(module="BigModule") foo.i where foo.i contains the 'foo' declaration and maybe a couple of extra %include directives, as needed. 09/11/2005: mmatus Fix bug #1282637, about the -module option not having effect in places where it was needed. 09/11/2005: wsfulton When wrapping variables, ensure that none of the typemaps used for the set wrappers are used when generating the get wrappers. I doubt this was a problem for any languages except for the recently introduced null attribute in the out typemap (C# only). 09/08/2005: wsfulton More descriptive error messages when files fail to open. 09/06/2005: mmatus Allow a %define a macro inside another %define macro, for example %define hello(name, Type) %define name ## a(Type) %typemap(in) Type "hello;"; %enddef %enddef To learn how to use this new features in your own typemaps library, see python/cstring.i, python/cwstring.i and python/cwstrbase.i. [Python] Normalize the cstring.i implementation to use fragments, and add cwstring.i, which implements the same typemaps but for wchar_t strings. [Python] Bug fixed: 1247477, 1245591, 1249878 and others. 08/18/2005: wsfulton [Ruby] Implement support for SWIGTYPE* DISOWN typemap (like in Python) for better control of memory management, eg when adding an object created in Ruby to a C++ container. Patch #1261692 from Charlie Savage. 08/18/2005: wsfulton [Tcl] 64 bit platform fixes for the varargs handling in SWIG_GetArgs. This is an improved fix for bug #1011604 as suggested by Jeremy Lin. 08/18/2005: wsfulton [Tcl] Bug #1240469 - %newobject support for Tcl. Patch from Bob Marinier. 08/16/2005: wsfulton [Perl] Bug #1254494 - Fix for global namespace pollution by perl header files (bool define) prevented STL headers from being used on some systems, eg Windows with Visual Studio. 08/16/2005: wsfulton [Java] Bug #1240937 - Redefinition of __int64 typedef for Intel compilers. 08/15/2005: wsfulton [Xml] Bug #1251832 - C++ template may generate invalid XML file 08/15/2005: wsfulton [Lua] Support added for Lua. Patch #1242772 from Mark Gossage. It supports most C/C++ features (functions, struct, classes, arrays, pointers, exceptions), as well as lots of documentation and a few test cases & examples. 08/14/2005: wsfulton [Xml] Fix incorrect xml escaping in base class name when base class is a template. 08/13/2005: efuzzyone [CLISP] Added support for handling enums. Does not adds the return type declaration to the function definition, if a function returns void. 08/09/2005: mkoeppe New language module, Common Lisp with UFFI, from Utz-Uwe Haus. 08/09/2005: mkoeppe Fix the Lisp s-expression output module; it no longer complains about "unknown targets". 07/27/2005: wsfulton Modifications to STL wrappers so that it is possible for a user's %exception directive to be applied to the STL wrapper methods. Previously the following global %exception directive would not be used on the wrapper methods: %exception { try { $action } catch (...) { // handle uncaught exceptions } } This has been implemented by replacing %exception directives for specific STL wrapper methods with an exception specification declared on the wrapper methods. throws typemaps are now supplied for handling the STL exception specification. These can also be easily overridden, for example the std::out_of_range exception, which is used a lot in the STL wrappers, can be customised easily: %include "std_vector.i" %typemap(throws) std::out_of_range { // custom exception handler } %template(VectInt) std::vector; 07/22/2005: efuzzyone [CLISP] The clisp module for SWIG: - It can only handle C, clisp currently does not supports ffi bindings to C++. - It has two options, (a) -extern-all this will generate wrappers for all functions and variablestions, (b) -generate-typedef this will generate wrappers "def-c-type" wrappers for typedefs - Can handle pointers to functions, complex types such as n-dimensional arrays of pointers of depth d - Generates wrappers for constants as well as variables - Correctly distinguishes between the declaration of variables in structures and functions - Creates a defpackage "declaration" with the module name as the package name, the created package exports both functions and variables - tries to guess when should a pointer variable be declared as c-ptr or c-pointer 07/22/2005: wsfulton [C#] Changes to support C# structs returned by value. The changes required are: - Using an optional 'null' attribute in the out typemap. If this attribute is specified, then it is used for the $null special variable substitution. - The ctype used in the C/C++ wrappers is no longer initialised to 0 on declaration. Both of these changes fix the situations where an attempt was made to assign 0 to the returned struct. Marshalling structs as value types still requires user defined typemaps. See documentation for an example. 07/22/2005: wsfulton [C#, Java] Fix SWIG_exception usage to work with compilers that don't support empty macro arguments. Unfortunately this fix will stop usage of SWIG_exception being used within typemaps that use "" or %{ %} delimiters, but continues to work with typemaps using {} delimiters. Please use the SWIG_CSharpSetPendingExceptionArgument or SWIG_JavaThrowException methods instead as SWIG_exception is really intended as a platform independent macro for the SWIG library writers. 07/16/2005: mkoeppe [Allegro CL] Use specific foreign types rather than (* :void). Use *swig-identifier-converter*. 06/27/2005: wsfulton Functions declared as 'extern' no longer have an additional function declaration added to the wrapper files. There are some cases where SWIG does not get this right, eg bug #1205859 (extern functions with default arguments declared in a namespace). Also SWIG cannot get non-standard calling conventions correct, eg Windows calling conventions are usually handled like this: %{ #define DLLIMPORT __declspec(dllimport) #define STDCALL __stdcall %} #define DLLIMPORT #define STDCALL %inline %{ DLLIMPORT extern STDCALL void function(int); %} SWIG incorrectly generates: extern void function(int); To which there is no solution as SWIG doesn't handle non-standard calling conventions. The extra 'extern' function that SWIG generates is superfluous unless a user has forgotten to add the function declaration into the wrappers. The -noextern commandline argument is now redundant and a new commandline argument -addextern can be used to obtain the original behaviour. This shouldn't be necessary unless the header file containing the function declaration was inadvertently not added to the wrappers. To fix this add the function declaration into your wrappers, For example, replace: extern void foo(int); with: %inline %{ extern void foo(int); %} *** POTENTIAL INCOMPATIBILITY *** 06/22/2005: wsfulton [C#, Java, Modula3, Ocaml] The intermediary function names have been changed when wrapping variables to match the other language modules so that %extend for a member variable works uniformly across all language modules, eg: %extend ExtendMe { Var; }; %{ void ExtendMe_Var_set(ExtendMe *, double) {...} double ExtendMe_Var_get(ExtendMe *) {...} %} The methods implementing the get/set used to be: %{ void set_ExtendMe_Var(ExtendMe *, double) {...} double get_ExtendMe_Var(ExtendMe *) {...} %} This also changes the name of variable wrapper functions when using -noproxy. The original names can be generated with the -oldvarnames commandline option. *** POTENTIAL INCOMPATIBILITY *** Version 1.3.25 (June 11, 2005) ============================== 06/11/2006: mkoeppe [Guile] Fix handling of anonymous-enum variables. 06/10/2005: mkoeppe [Guile] Fix for function arguments that are passed by copy-of-value. Fix for global "const char *" variables. Fix testcases arrays_dimensionless, arrays_global. 06/08/2005: wsfulton Fix for when a base class defines a symbol as a member variable and a derived class defines the same symbol as a member method. 06/08/2005: wsfulton [C#] More fixes for virtual/new/override modifiers - when a method has protected access in base and public access in derived class. 06/02/2005: wsfulton Fix #1066363 - Follow convention of release tarball name matching directory name. 06/02/2005: wsfulton [C#, Java] Fix #1211353 - typesafe enums (and Java proper enums) wrappers when enum value is negative. 05/27/2005: wsfulton Modernised and tidied up Windows macros --> SWIGEXPORT, SWIGSTDCALL. They can be overridden by users via -D compiler directives if need be. 05/26/2005: wsfulton %csmethodmodifiers can be applied to variables as well as methods now. In addition to the default 'public' modifier that SWIG generates, %csmethodmodifiers will also replace the virtual/new/override modifiers that SWIG thinks is appropriate. This feature is useful for some obscure cases where SWIG might get the modifiers incorrect, for example with multiple inheritance and overriding a method in the base class. *** POTENTIAL INCOMPATIBILITY FOR C# MODULE *** 05/25/2005: wsfulton Added missing constructors to std::pair wrappers (std_pair.i) for all languages. 05/25/2005: wsfulton [C#] Added std::pair wrappers in std_pair.i 05/25/2005: wsfulton [C#] The C# 'new' and 'override' modifiers will be generated when a C++ class inherits methods via a C++ 'using' declaration. 05/25/2005: wsfulton Fix for exception specifications previously being ignored in classes that inherited methods from 'using' declarations, eg calls to Derived::bar below will convert C++ exceptions into a target language exception/error, like it always has done for Base::Bar. class Base { virtual bar() throw (std::string); }; class Derived : public Base { using Base::bar; }; 05/23/2005: wsfulton Fixes for detecting virtual methods in %extend for the -fvirtual option and C# override and new method modifiers. 05/23/2005: wsfulton [C#] The 'new' modifier is now generated on the proxy method when a method in a derived class is not polymorphic and the same method exists in the derived class (ie it hides the base class' non-virtual method). 05/23/2005: wsfulton [Java, C#] Fixes to detection of covariant return types - when the class hierarchy is more than 2 classes deep. 05/21/2005: wsfulton [Java] std::wstring typemaps moved from std_string.i to std_wstring.i 05/21/2005: wsfulton Fix for crash in DohStrstr, bug #1190921 05/21/2005: wsfulton [TCL] Fix for methods with similar names when showing list of names on error - bug #1191828. Patch from Jeroen Dobbelaere. 05/21/2005: wsfulton [TCL] long long overloading fix - bug #1191835, patch from Jeroen Dobbelaere. 05/21/2005: wsfulton Fix bug #1196755 to remove debug from swigtcl8.swg. 05/19/2005: wsfulton [C# and -fvirtual option] Fix for the override key not being generated in the derived class when a virtual method's return type was a typedef in either the base or derived class. Also ensures the method is eliminated when using the -fvirtual option. For example, Derived.method now has the C# override keyword generated: typedef int* IntegerPtr; struct Base { virtual IntegerPtr method(); }; struct Derived : Base { int * method() const; }; [C#] Fix for the override key being incorrectly generated for virtual methods when a base class is ignored with %ignore. 05/13/2005: wsfulton [Java] Fixes to remove "dereferencing type-punned pointer will break strict-aliasing rules" warnings in C wrappers when compiling C code with 'gcc -Wall -fstrict-aliasing'. Patch from Michael Cahill. This modifies many of the casts slightly, for example arg1 = *(DB_ENV **)&jarg1; to arg1 = *(DB_ENV **)(void *)&jarg1; 05/12/2005: wsfulton [C#] Support for C# attributes. C# attributes can be generated: 1) On a C/C++ type basis by specifying an inattributes and/or outattributes typemap attribute in the imtype or cstype typemaps (for C# return type or C# parameter type attributes). 2) On a wrapped method or variable by specifying a csattributes feature (%feature). 3) On a wrapped proxy class or enum by specifying a csattributes typemap. Examples are in the C# documentation (CSharp.html). 04/29/2005: wsfulton New configure option to turn off the default maximum compiler warning as they couldn't be removed even when overriding CFLAGS and CXXFLAGS with configure (./configure CFLAGS= CXXFLAGS=). To turn the maximum warnings off, run: ./configure --without-maximum-compile-warnings 04/28/2005: wsfulton Patch from Scott Michel which reworks the Java constructor and finalize/destructor typemaps, for directors to reduce the number of overall Java typemaps. Added the director_take and director_release typemaps to emulate other modules' __disown__ functionality. *** POTENTIAL INCOMPATIBILITY FOR JAVA DIRECTORS *** 04/28/2005: wsfulton [C#] Fixed problems due to the over eager garbage collector. Occasionally the garbage collector would collect a C# proxy class instance while it was being used in unmanaged code if the object was passed as a parameter to a wrapped function. Needless to say this caused havoc as the C# proxy class calls the C++ destructor when it is collected. Proxy classes and type wrapper classes now use a HandleRef, which holds an IntPtr, instead of a plain IntPtr to marshal the C++ pointer to unmanaged code. There doesn't appear to be any performance degradation as a result of this modification. The changes are in the proxy and type wrapper classes. The swigCPtr is now of type HandleRef instead of IntPtr and consequently the getCPtr method return type has also changed. The net effect is that any custom written typemaps might have to be modified to suite. Affected users should note that the implementation uses the new 'out' attribute in the imtype typemap as the input type is now a HandleRef and the output type is still an IntPtr. *** POTENTIAL INCOMPATIBILITY FOR C# MODULE *** 04/28/2005: wsfulton [C#] Support for asymmetric type marshalling added. Sometimes the output type needs to be different to the input type. Support for this comes in the form of a new optional 'out' attribute for the ctype, imtype and cstype typemaps. If this typemap attribute is not specified, then the type used for both input and output is the type specified in the typemap, as has always previously been the case. If this typemap attribute is specified, then the type specified in the attribute is used for output types and the type specified in the typemap itself is used for the input type. An output type is a return value from a wrapped method or wrapped constant and an input type is a parameter in a wrapped method. An example shows that char * could be marshalled in different ways, %typemap(imtype, out="IntPtr") char * "string" char * function(char *); The output type is thus IntPtr and the input type is string. The resulting intermediary C# code is: public static extern IntPtr function(string jarg1); 04/22/2005: mkoeppe (Matthias Koeppe) [Guile] Fix generation of "define-method" for methods of classes with a constructor. Reported by Luigi Ballabio. 04/15/2005: wuzzeb (John Lenz) [Chicken] For wrapped functions that return multiple values (using argout), SWIG CHICKEN now returns them as multiple values instead of as a list. They can then be accessed using (call-with-values). 04/14/2005: wuzzeb (John Lenz) [Chicken] + Added a whole bunch of new _runme scripts into the chicken test suite. Also fix some bugs these new scripts turned up. + Added optimization when returning a wrapped proxy class. Before, a minor garbage collection was invoked every time a function returned. + All the chicken Examples should now run correctly 04/14/2005: wsfulton [C#] More fixes for typemap matching when wrapping variables, in particular std::string, so that std::string variables can be easily marshalled with a C# string property using: %include "std_string.i" %apply const std::string & { std::string *variable_name }; std::string variable_name; (Recall that all class variables are wrapped using pointers) 04/05/2005: wuzzeb (John Lenz) [Chicken] + Added Examples/chicken/egg, an example on how to build a chicken extension library in the form of an egg. Also updated the documentation on the different linking options. + chicken test-suite now has support to check SWIG with the -proxy argument if there exists a _proxy_runme.ss file. + More fixes for overloaded functions and -proxy 03/31/2005: wsfulton Turned on extra template features for all languages which were previously only available to Python. This enables typemaps defined within a templated class to be used as expected. Requires %template on the templated class, %template() will also pick up the typemaps. Example: template struct Foo { ... %typemap(in) Foo "in typemap for Foo " or %typemap(in) Foo "in typemap for Foo " }; %template(Foo_i) Foo; %template() Foo; will generate the proper 'in' typemaps wherever Foo and Foo are used. 03/30/2005: mkoeppe (Matthias Koeppe) [MzScheme] Patch from Hans Oesterholt for supporting MzScheme 30x. 03/29/2005: wuzzeb (John Lenz) [Chicken] + Reallow older versions of chicken (1.40 to 1.89) by passing -nocollection argument to SWIG + %import now works correctly with tinyclos. (declare (uses ...)) will be exported correctly. + TinyCLOS proxy classes now work correctly with overloaded functions and constructors. 03/29/2005: wsfulton [Java] Patch from Scott Michel for directorout typemaps. Java directors require the directorout typemaps like the other languages now. The new typemaps provide fixes for methods where the return type is returned by reference (this cannot automatically be made thread safe though). 03/22/2005: wsfulton Enum casting fixes. Visual C++ didn't like the C type casting SWIG produced when wrapping C++ enum references, as reported by Admire Kandawasvika. 03/21/2005: wsfulton [Perl] SF #1124490. Fix Perl macro clashes when using Visual Studio's STL string, so now projects can #include . 03/21/2005: wsfulton Fixed %varargs which got broken with the recent default argument changes. Also works for Java and C# for the first time now. 03/17/2005: wuzzeb (John Lenz) [Chicken] + Fix a whole bunch of bugs in the chicken module. The entire test suite now compiles, with the exception of the tests that require std_vector.i, std_deque.i, and so on, which chicken does not have yet. + Add support for %exception and %typemap(exceptions). Exceptions are thrown with a call to (abort) and can be handled by (handle-exceptions) 03/15/2005: wsfulton [Java] Patch from Scott Michel for directors. Modifications to the typemaps giving users fine control over memory ownership and lifetime of director classes. Director classes no longer live forever by default as they are now collectable by the GC. 03/15/2005: wuzzeb (John Lenz) [Chicken] Add support for adding finalizers garbage collected objects. Functions that return new objects should be marked with %newobject and input arguments which consume (or take ownership) of a pointer should be marked with the DISOWN typemap. Also add support for correctly checking the number of arguments passed to a function, and raising an error if the wrong number are passed. 03/14/2005: wuzzeb (John Lenz) Add --without-alllang option to configure.in, which is the same as passing all the --without-python --without-perl5 etc... that Matthias added. 03/09/2005: wsfulton [Php] Memory leak fix for functions returning classes/structs by value. 03/08/2005: wsfulton [Perl] Fix for Perl incorrectly taking memory ownership for return types that are typedefs to a struct/class pointer. Reported by Josh Cherry. 03/07/2005: wsfulton [C#] Various exception changes for the std::vector wrappers. These now more accurately mirror the same exceptions that System.Collections.ArrayList throw. 03/07/2005: wsfulton [C#] Fix undefined behaviour after any of the std::vector methods throw an exception. 03/07/2005: wsfulton [C#] When null is passed for a C++ reference or value parameter, the exception thrown has been corrected to an ArgumentNullException instead of NullReferenceException as recommended in the .NET Framework documentation. The default throws typemaps turn a C++ exception into an ApplicationException, not a SystemException now. 03/07/2005: wsfulton [C#] Numerous changes in C# exception handling have been made over the past few weeks. A summary follows: The way in which C++ exceptions are mapped to C# exceptions is quite different. The change is to fix C# exceptions so that the C++ exception stack is correctly unwound as previously C++ exceptions were being thrown across the C PInvoke layer into the managed world. New typemap attributes (canthrow and excode) have been introduced to control the mapping of C++ to C# exceptions. Essentially a callback into the unmanaged world is made to set a pending exception. The exception to throw is stored in thread local storage (so the approach is thread-safe). The typemaps are expected to return from unmanaged code as soon as the pending exception is set. Any pending exceptions are checked for and thrown once managed code starts executing. There should be minimal impact on execution speed during normal behaviour. Full details will be documented in CSharp.html. The SWIG_CSharpThrowException() function has been removed and replaced with the SWIG_CSharpSetPendingExceptionArgument() and SWIG_CSharpSetPendingException() functions. The original name has been deliberately changed to break old code as the old approach was somewhat flawed. Any user defined exceptions that follow the same pattern as the old approach should also be fixed. Numerous new .NET framework exceptions are now available for easy throwing from unmanaged code. The complete list is: ApplicationException, ArithmeticException, DivideByZeroException, IndexOutOfRangeException, InvalidOperationException, IOException, NullReferenceException, OutOfMemoryException, OverflowException, SystemException, ArgumentException, ArgumentNullException and ArgumentOutOfRangeException. *** POTENTIAL INCOMPATIBILITY FOR C# MODULE *** 05/05/2005: mmatus Fix several memory leaks around. Even when we survive knowning swig is a memory leak factory, it was a little out of control. To run std_containers.i in the python test-suite, swig was using ~260MB, now it uses 'only' ~40MB, which is the same ammount that g++ uses, so, is not that bad. In the process, I found a couple of extra Deletes, which in some cases could trigger seg. faults and/or DOH/asserts. [python] Better support for directors + exception. More verbose errors and added an unexpected exception handler. [python] Fix memory leak for the std::vector > case,reported by Bo Peng. [python] Fix SwigPyObject compare problem reporte by Cameron Patrick. [python] Fix several warnings in the generated code for gnu-gcc, Intel and VC7.1 compilers. 02/25/2005: wuzzeb (John Lenz) Update documentation to use CSS and
instead of
I used a script to convert the docs, and it set all the box classes to be "code". There are actually 4 different classes, "shell", "code", "targetlang", and "diagram". We need to go through and convert the divs depending on what they contain. 02/23/2005: mmatus [Python] Added option -nortti to disable the use of native C++ RTTI with directors (dynamic_cast<> is not used). Add more code for directors to detect and report errors in the python side. Extend the use of SWIGINTERN whenever is possible. Remove template warnings reported by VC7.1. Remove warnings reported by gcc/g++. Finally you can compile using g++ -W -Wall -c mymodule_wrap.cxx and no spurious errors will be generated in the wrapper code. 02/23/2005: wuzzeb (John Lenz) Added -external-runtime argument. This argument is used to dump out all the code needed for external access to the runtime system, and it replaces including the files directly. This change adds two new virtual functions to the Language class, which are used to find the language specific runtime code. I also updated all languages that use the runtime to implement these two functions. 02/22/2005: mmatus Fix %template + private error SF#1099976. 02/21/2005: mmatus Fix swigrun.swg warnings reported when using "gcc -W -Wall" (static/inline not used in front of a function declaration), and add SWIGUNUSED attribute to avoid unused warnings elsewhere. Fix unused variable warnings. [Python] Use new SWIGUNUSED attribute to avoid warnings in SWIGINTERN methods. [Python] Fix PyOS_snprintf for python versions < 2.2 (SF #1104919). [Python] Fix map/multimap to allow empty maps (reported by Philippe Hetroy). [Docs] Add some documentation to Python.html and SWIGPlus.html, including for example the fact that 'friends' are now supported. 02/21/2005: wsfulton [PHP] Patch from Olly Betts, so that wrappers compile with Zend thread safety enabled. 02/17/2005: wsfulton Memory leak fix in some of the scripting language modules when using default arguments in constructors. The scripting language was not taking ownership of the C++ object memory when any of the constructors that use default arguments was called. 02/16/2005: wsfulton SF #1115055: Failed make install. Patch from Rob Stone. 02/16/2005: wsfulton [Java] SF #1123416 from Paul Moore. Correct memory allocation for STRINGARRAY typemaps in various.i. 02/15/2005: wsfulton Disabled typemap search changes for now (see entry 19/12/2004). It breaks old typemaps, lengthens the execution time by about 25% and introduces inconsistencies. 02/15/2005: wsfulton swig -help follows other software by printing to stdout instead of stderr now. swig -version also displays to stdout instead of stderr now. Behaviour reported by Torsten Landschoff. 02/15/2005: wsfulton [Ruby] Fix for the less commonly used ordering of %include and #include, so that the generated code compiles. Bug reported by reported by Max Bowsher. %include foo.h %{ #include foo.h %} 02/15/2005: wsfulton [C#, Java] SWIG_exception macro will now return from unmanaged code / native code as soon as it is called. Fixes possible JVM crashes and other code unexpectedly being executed. Note SWIG_exception is only occasionally used by SWIG library writers, and is best avoided by SWIG users. 02/15/2005: wsfulton [C#, Java] Typemaps can now be targeted at global variable names and static member variable names. Previously the typemaps for the setters were ignored, for example: %typemap(in) int globalint "..." int globalint; 02/13/2005: mkoeppe (Matthias Koeppe) [Guile] Add %typecheck for SWIGTYPE, add %typecheck for ptrdiff_t, fix typemaps for size_t. [Pike] Merge patch from Torsten Landschoff for improved Pike configuration. 02/12/2005: mkoeppe (Matthias Koeppe) New configure switches --without-tcl, --without-python etc. allow to disable the search for installed languages. 01/31/2005: wuzzeb (John Lenz) - Add DohSortList to DOH - Improve the runtime type system: + Speed. Type loading is now O(n log n) instead of O(N^2), which for large modules is a huge improvement. + A whole bunch of functions in swigrun.swg no longer need the swig_type_list_handle passed to them. The only one left is TypeQuery. This also makes runtime.swg a lot smaller. + Split up swig_type_info structure into two structures (swig_type_info and swig_cast_info) + Store a pointer to a swig_type_info rather than just the type name string in the linked list of casts. First off, this makes the guile module a little faster, and second, the SWIG_TypeClientData() function is faster too. + Add the idea of a module into the type system. Before, all the types were stored in one huge linked list. Now, another level is added, and the type system stores a linked list of modules, each of which stores an array of types associated with it. + For more information of how the runtime type system now works, please see Doc/Manual/typemaps.html and Doc/Devel/runtime.txt - Update all language modules to use the new type system. The changes to each language module are minor. All languages are now able to use runtime.swg for external access to the type system. Before only python and perl did. - [guile, mzscheme, ocaml, and php4] These languages opened up the init function inside the .cxx code, and any code in the .swg files in the init section was inside this function. This was a problem for swiginit.swg, which needs to be inserted before the SWIG_init function is opened. Thus I changed these languages to be like python or perl, where the init function is declared in the .swg file. - [Ruby] Instead of moving the init function to the .swg file, I added a new section initbeforefunc, and then added %insert(initbeforefunc) "swiginit.swg" - [MzScheme] Fix enums and fix Examples/Makefile.in so that if multiple -I arguments are specified in the INCLUDES variable, each gets a ++ccf. - [Guile GH] Update Guile GH to use the new type system. See Doc/Manual/Guile.html for how smobs are now used. 01/11/2005: wsfulton [C#] New typemap called 'csconstruct'. The code in this typemaps was previously hard coded and could not be customised by a user. This typemap contains the code that is generated into a proxy class's constructor. [Java] New typemap called 'javaconstruct'. The code in this typemaps was previously hard coded and could not be customised by a user. This typemap contains the code that is generated into a proxy class's constructor. Another typemap named 'javaconstruct_director' is used instead when the proxy class is a director class. [C#, Java] If a C++ class did not have a default constructor, a protected default constructor was automatically generated by SWIG. This seems is unnecessary and has been removed and thereby giving the user almost complete control over the generated code along with the new typemaps above. 19/12/2004: mmatus [Disabled, see entry 02/15/2004] - Fix typemap search, now the "out" typemap search is done as follows int *Foo::foo(int bar) -> int *Foo::foo(int bar) -> int *Foo::foo -> int *foo(int bar) -> int *foo -> int * then, now you can be more specific, and define /* apply only for 'Foo::foo' method */ %typemap(out) int * Foo::foo(int *bar) ...; /* apply for all 'foo' functions/methods */ %typemap(out) int * foo(int *bar) ...; %inline { struct Foo { int *foo(int *bar); }; } 15/12/2004: mmatus - More fixes for templates and template default args. See template_default.i for scary cases that now are supported, besides the already ugly STL/std cases. - Cosmetics and more use of 'const' where it was implicit. - Other fixes for OSS, which is now working again with 1.3.25. Version 1.3.24 (December 14, 2004) ================================== 12/12/2004: wuzzeb (John Lenz) [Chicken] Fix a bunch of bugs relating to -proxy support + non-class variables now export properly using -proxy + static member functions now export properly using -proxy + member class variables now export properly using -proxy + added a -nounit argument, which does not export the (declare (unit ...)) + correctly install swigclosprefix.scm + constants (enums, defines) now correcly export when using -proxy 12/11/2004: wsfulton configure fix for when more than one version of jni_md.h is found in the Java include directory (was generating lots of sed error messages). 12/08/2004: wsfulton [Java] Fixes to arrays_java.i so that one can apply the array typemaps to functions taking pointers as input, eg %include "arrays_java.i" %apply int[] {int*}; void foo(int *a); 12/05/2004: wsfulton [Java] Director mods contributed by Scott Michel. New typemaps directordisconnect and directordisconnect_derived for the swigDirectorDisconnect() method. Also fix to get the javapackage typemap working again. 12/05/2004: mmatus - Finishing the fixes for templates + default template args + specializations. - [Python] Now we use the new templates + default template args in the std/STL library. That means the internal swig files are getting uglier since we now support the original declarations: template > class vector { .... }; template, class _Alloc = std::allocator > > class map { .... }; and the user can use the %template directive as %template() std::vector; %template() std::vector >; %template() std::vector >; Now we are closer to the cleaning/rewriting of the python std/STL support, such that we recover support for MSVC++ 6.0, and we can add support for other languages too. 12/02/2004: wsfulton [Java] Fix for directors when wrapping methods using a member enum and typesafe/proper enums enabled. 12/01/2004: mmatus - Fix typemaps to work with templates and default template args, ie template struct Foo { }; %typemap(in) Foo *{...} %typemap(out) Foo *{...} Foo * foo( Foo *f1, Foo *f2); now 'f1', 'f2' and the return value resolve the provided typemaps properly. This is highly needed for proper STL support, see new std_basic_string.i, std_sstream.i, etc. - Added std_sstream.i, and fix std_basic_string.i to use the new typemaps + template def. arg mechanism. Also, added the needed std_alloc.i. Now, all the containers can be modified to support std::allocator, like in: template > class vector { public: .... }; This change is only completed by now for basic_string. - Fix for smart pointers + members + extensions: %extend Foo { int extension(int i, int j) { return i; } int extension() { return 1; } } %inline %{ class Foo { public: int y; static const int z; }; class Bar { Foo *f; public: Bar(Foo *f) : f(f) { } Foo *operator->() { return f; } }; now you can f = Foo() f.y = 3 a = f.z f->extension() b = Bar(f) b.y = 3 a = b.z b->extension() - Other small errors fixes, mostly python. 11/25/2004: wsfulton [Java] Numerous director bug fixes so that the correct java types and canonicalized types in the JNI code are emitted. Use of the $javaclassname special variables in the director typemaps now consistent with the non-director typemaps. The types used for typemap lookups are also corrected in a few places. If you previously had your own director typemaps, ensure they are using the correct C++ type. *** POTENTIAL INCOMPATIBILITY FOR JAVA DIRECTORS *** 11/25/2004: wsfulton const enum SWIGTYPE & typemaps added. These wrap const enum references as if they were passed by value. Const enum references thus work the same as const reference primitive types such as const double &, const int & etc. Typemaps added for Java, C#, Ruby, Tcl, Perl and Pike. 11/25/2004: wsfulton [Java, C#] New special variable: $*javaclassname, similar to $javaclassname and $&javaclassname. The new one removes a pointer from the C type before obtaining the Java class name. One or more of $javaclassname, $&javaclassname or $*javaclassname may now appear in a typemap. Likewise for C# using csclassname instead of javaclassname. 11/25/2004: wsfulton The last vestiges of enums being handled as integers removed from the internals. The wrapper methods use the enum type rather than an int now. The net result is added type safety for enums when handled as pointers, references etc. Previously in situations such as a method taking a pointer to an enum, a pointer to an int or a pointer to an enum of some other type could inadvertantly be passed to the method. This is now fixed as the descriptor for an enum is no longer based on an int, but the enum type instead. Anonymous enums are still handled as integers. The consequence for scripting language users in correct usage of enums should not be noticeable. There is no change for any of the languages where enums are passed by value - most of the scripting languages will still accept an integer for an enum value and the strongly typed languages still use either typesafe enums, integers or proper enums depending on what the user configures. For Java and C# users a change in the typewrapper class name has occurred (for enum pointers, references etc). For example: enum Numbers { one=1, two }; enum Numbers* number(); In Java and C# this must now be coded as SWIGTYPE_p_Numbers n = modulename.number(); rather than SWIGTYPE_p_int n = modulename.number(); *** POTENTIAL INCOMPATIBILITY *** 11/21/2004: wsfulton/mmatus Added missing deprecated warning for %name and remove remaining %name usage in the SWIG libraries. 11/21/04: mmatus - [Python] Adding the PySwigObject to be used for carrying the instance C/C++ pointers. This is used instead of string and PyCObjects. The new PySwigObject is even safer than PyCObject, and more friendly than plain strings: now you can do print a.this print str(a.this) _00691608_p_A print long(a.this) 135686400 print "%s 0x%x" % (a.this, a.this) _00691608_p_A 0x8166900 the last one is very useful when debugging the C/C++ side, since is the pointer value you will usually get from the debugger. Also, if you have some old code that uses the string representation "_00691608_p_A", you can use it now again using 'str(ptr)', or by calling 'str = PyObject_Str(obj)' in the C/C++ side. This change is mainly for nostalgic swig users that miss the string representation, but also allows to say again if a.this == b.this: return "a is b" and well, since the change were really simple, maybe in the future we will be able to do next = a.this + 1 or add native python iteration over native C/C++ arrays, ie, no need to create/copy new tuples when returning and array or vector. Also, a PySwigPacked object was adding to carry a member method pointer, but this is probably a temporal solution until a more general object for methods is added. Be aware that to simplify maintaining and compatibility with other tools, the old string and PyCObjects representation could disappear very soon, and the SWIG_COBJECTS_TYPES or SWIG_NO_OBJECT_TYPES macros will have no effect at compilation time. Still, the three mechanisms are present in the code just for testing, debugging and comparison purposes. 11/21/04: mmatus - [Python] Adding back support for using the swig runtime code inside the user code. We just allow the user to include the minimal code needed to implement the runtime mechanism statically, just as in done in the swig modules. To use the swig runtime code, for example with python, the user needs include the following: #include // or using your favorite language #include #include // or using your favorite language #include the files swigrun.swg, pyrun.swg and runtime.swg can be checked out by using swig -co, or they can simply be found by adding the swig lib directory to the compiler include directory list, for example SWIGLIB=`swig -swiglib` c++ -I${SWIGLIB} .. of better, using the CPPFLAGS, but that depends on your environment. This change can be ported to the other languages too, you just need to isolate the needed runtime code in a single file like 'pyrun.swg', and provide the SWIG_Runtime_GetTypeList() method. Look at the Lib/python/pyrun.swg file and the Examples/python/swigrun example. 11/15/04: mmatus - Fix mixed_types.i + gcc-3.4, ie, arrays + references + typedefs - Fix multidim arrays + typedefs,ie typedef char character[1]; typedef character word[64]; - Process protected/private bases in the same way before we process protected/private members, ie, we check for constructors, operator new, virtual members, etc. - Fix Ruby/Java to work (or ignore) multi-inheritance + directors. Allow other languages to define if it is supported or not. - Now you can run SWIG_FEATURES="-directors -dirprot" make check-ruby-test-suite make check-python-test-suite make check-java-test-suite make check-ocaml-test-suite and you will get only 'real' errors. ruby and python compile with no errors, java shows some problems. Version 1.3.23 (November 11, 2004) ================================== 11/05/2004: wsfulton Patch #982753 from Fabrice Salvaire: Adds dependencies generation for constructing makefiles. New command line options -MF -MD -MMD to work with the current options -M and -MM. These options are named the same and work the same as in gcc. 11/05/2004: wsfulton %ignore/%rename changes for methods with default arguments to mirror %feature behaviour. See previous entry. *** POTENTIAL INCOMPATIBILITY *** 11/04/2004: wsfulton %feature improvements for fine tuning when wrapping methods with default arguments. Any %feature targeting a method with default arguments will apply to all the extra overloaded methods that SWIG generates if the default arguments are specified in the feature. If the default arguments are not specified in the feature, then the feature will match that exact wrapper method only and not the extra overloaded methods that SWIG generates. For example: %feature("except") hello(int i=0, double d=0.0); void hello(int i=0, double d=0.0); will apply the feature to all three wrapper methods, that is: void hello(int i, double d); void hello(int i); void hello(); If the default arguments are not specified in the feature: %feature("except") hello(int i, double d); void hello(int i=0, double d=0.0); then the feature will only apply to this wrapper method: void hello(int i, double d); and not these wrapper methods: void hello(int i); void hello(); This has been introduced to make %feature more powerful to ease the migration to new default arguments wrapping approach. *** POTENTIAL INCOMPATIBILITY *** If you previously had a %feature and didn't specify the default arguments, you will have to add them in now or you can obtain the original behaviour by using %feature("compactdefaultargs"). 11/04/2004: wsfulton [C#] Typemaps for std::vector added into std_vector.i. The proxy classes generated are modelled on the .NET ArrayList class. This isn't quite ready for general consumption yet, but will work with vectors of primitive types and some classes. 10/3/2004: wuzzeb (John Lenz) [GUILE] The -scm interface is now the default. The old GH interface can still be enabled by passing -gh to SWIG. 10/2/2004: mmatus - More fixes for namespace + class declarations. As an extra bonus, we get %template support for static/members class methods, ie, now you can say: namespace space { struct A { template static void fooT(Y y) { } }; } struct B { template void barT(Y y) {} }; %template(foo) space::A::fooT; %template(foo) space::A::fooT; %template(foo) space::A::fooT; %template(bar) B::barT; %template(bar) B::barT; %template(bar) B::barT; and call A.foo(1) b = B() b.bar(1) note the methods are emitted inside the classes, and hence, the %template name refers to the 'member' method name, not a global namespace name. 10/31/2004: mmatus - Solve namespace + class declarations, as in namespace foo { struct Bar; struct Foo { }; } struct foo::Bar : Foo { }; see namespace_class.i for more examples. - Fix %template directive to properly use namespaces, including the case: namespace one { template struct Ptr {}; } namespace one { struct Obj1 {}; typedef Ptr Obj1_ptr; %template(Obj1_ptr) Ptr; } namespace two { struct Obj2 {}; typedef one::Ptr Obj2_ptr; %template(Obj2_ptr) one::Ptr; } this is done by using the namespace name 'one' to create a namespace node to emit the template instantiation, just as before, but the template parameters are resolved and qualified in the current namespace ('one' or 'two'). This is same way that typedef works. This resolve the smart_pointer_namespace2.i case, and at the same time, several other ones where before swig was generating the "Can't instantiate template 'xx' inside namespace 'yy'" error message. In fact, that error doesn't exist anymore. You can only get an error if you use a bad namespace name or so. 10/30/2004: mmatus - [ruby] Directors fixes: - enums and std::strings are working now (several reports in bug track system) - added patch 1025861 for director + exceptions *** Attention ***: ruby with directors + protected members work with version 1.7+. Older versions seems to have a broken signature for'rb_protect'. If you need to use an old version, look at http://excruby.sourceforge.net/docs/html/ruby__hacks_8hpp-source.html for workarounds. - [ruby] Fix memory allocation problem in typemap (bug 1037259) - [tcl] Fix (enums|constants) + namespace option (reported by jason.m.surprise@intel.com). - [perl] Add patch 962168 for multiple inheretance - Fix 'defined' as variable name. 10/29/2004: wsfulton Seg fault fix for global scope operator used for friend methods: class B { friend void ::globalscope(); ... }; 10/28/2004:mmatus - Added module and swig option "templatereduce" to force swig to reduce any type needed with templates, ie, in these cases %module("templatereduce") test template struct A { }; typedef int Int; %template(A_Int) A ==> %template(A_Int) A typedef B* Bp; %template(A_Bp) A ==> %template(A_Bp) A swig reduces the types Int and Bp to their primitives int and B*. This is closer to the usual compiler resolution mechanism, and it is really needed sometimes when you mix templates + typedefs + specializations. Don't use it if you don't have any problem already, since the type reduction can interfere with some user typemaps, specially if you defined something like typedef int Int; %typemap(in) Int ...; in this case, when you use the "templatereduce" option, swig will ignore the user typemap, since the "typedef int Int" will take precedence, and the usual "int" typemap will be applied. Note that the previous case is not common, and should be avoided, ie, is not recommended to use a typedef and a typemap at the same time, specially if you are going to use templates + specializations. - Directors: virtual destructor is always emitted now, this doesn't cause any harm, and could solve some nasty and mysterious errors, like the one mentioned by Scott. also the destructor is not in-lined, so, that can solve some other mysterious errors when mixing directors + imports + embedded applications + some specific compilers. 10/27/2004: wsfulton [C#] typemaps.i library file with INPUT, OUTPUT and INOUT typemaps added. 10/27/2004: wsfulton [Java] std::wstring typemap fixes in std_string.i from Russell Keith-Magee. 10/25/2004: mmatus - Using + namespace is working now (using_namespace.i). - Derived + nested classes is working now (deriver_nested.i), but of course, we are still waiting for the nested class support. - Directors: - unnamed parameters support, - protected constructor support (automatic and with dirprot mode), - detection of really needed protected declarations (members and constructors) now is done automatically. Even if you don't use the 'dirprot' mode, swig will wrap what is minimally needed (and protected) for the code to compile. what is public, as usual, is always wrapped, and if you use the 'dirport' - Final fixes for the OSS to compile with SWIG 1.3.23 (my very very ugly C++ + templates + everything mounters wrap). 10/25/2004: wsfulton [C#] New commandline option -dllimport. This enables one to specify the name of the DLL for the DllImport attribute. Normally this name comes from the module name, so now it is possible to override this: swig -csharp -dllimport xyz example.i will generate for all the wrapped PInvoke methods: [DllImport("xyz", EntryPoint="...")] public static extern ... The wrappers from many different SWIG invocations can thus be compiled into one DLL. A new special variable $dllimport can also be used in typemaps, pragmas, features etc. This will get translated into the value specified by -dllimport if specified, otherwise the module name. 10/22/2004: wsfulton [Java] Patch #1049496 from Scott Michel fixes directors methods with enums when wrapped with typesafe or proper Java enums. 10/21/2004: wsfulton Fixes for default arguments in director constructors (Python, Ruby, Ocaml). 10/21/2004: mmatus - [Python] Add the '-cpluscast' option to enable the 'new' C++ casting operators, such as 'static_cast', inside the typemaps. By default swig use the old C cast style, even when parsing C++. - [Python] Add the '-new_vwm' option to enable the new SwigValueWrapper mode. Now this is mainly for testing that the typemaps are really safe for any future solution, but you can use it if you have a very strange error with default cosntructors missing + %apply + %typemap, and if everything else fails (see valuwrapper_opaque.i for alternative and current solutions). If you are a user that don't know what is SwigValueWrapper, don't even try it. - [Python] Add the '-noh' option to be used with directors and when you prefer to disable the generation of the director header file. If not used, swig will work as usual generating both the wrap.cxx and wrap.h files. If you use it, swig will only generate wrap.cxx. 10/21/2004: wuzzeb (John Lenz) - If you define SWIG_TYPE_TABLE when compiling a wrapper file, the runtime types will be stored in the given type table name. Using this, you can seperate different modules to share their own type systems. -DSWIG_TYPE_TABLE=Mytable - [Python] If you define SWIG_STATIC_RUNTIME then the type information will be static to this wrapper. Nothing will be shared with any other modules - [Python] If you define SWIG_LINK_RUNTIME, then instead of using the new way of sharing type information, the wrapper will expect to be linked against the Lib/linkruntime.c file. Any modules compiled with SWIG_LINK_RUNTIME and linked against linkruntime.c will all share type information. 10/20/2004: mmatus - [Python] Initial fix for python/import example. Please update the Makefile (autoconf, configure, etc, expert), since now probably is only working with g++, icc and a few other compilers that have the -shared option. We need to create additional shared libraries for the virtual destructors. Old and usually forgotten C++ requirement. Same fix need to be used in perl, I think. - [Python] Fix generation of header file for directors, now directors.swg is also included, so, it can be really used from C++, and it solves some problem with compiler that require that, even with the simple swig inclusion. - [Python] Reordering the methods and moving some bodies outside the class declaration. This is needed due to some gcc-2.96 internal compiler errors. It seems the PYTHON class is getting too large to been declared and defined at the same time. - Add the -oh option to change the output header file name if needed: swig -c++ -python test.i -o test.CC -oh test.HH this is mainly needed when using directors, and if the current default header file name is not good for you, which is generated as follow: swig -c++ -python test.i => test_wrap.h swig -c++ -python test.i -o test.CC => test.h 10/20/2004: wsfulton 1) Compact default arguments feature added. This feature allows one to use the default argument code generation that was used in SWIG-1.3.22 and earlier versions. It produces more compact wrappers as only one wrapper method is generated for any method with default arguments. So the advantage is it generates less code but has the original limitations, like it it does not work with all default arguments and default arguments cannot be taken advantage of in the strongly typed languages (C# and Java). It is implemented via the usual %feature mechanism: %feature("compactdefaultargs"); 2) Keyword arguments (kwargs) are working again for default arguments in the languages that support it, ie, Python and Ruby. The new default argument wrapping approach using overloaded methods cannot support kwargs so the compact default argument feature is automatically turned on when kwargs are specified, by %feature("kwargs"). 3) Compact default arguments are also automatically turned on when wrapping C (not C++) code. This is to support the bizarre notion of default arguments for C code. 10/20/2004: wsfulton Overloaded templated functions in namespaces also working now. Templated functions with default arguments in namespaces too. 10/19/2004: mmatus - Allow to disable the new SwigValueWrapper mechanism, if you add the following line in your language main. /* Turn on safe value wrapper use mode */ Swig_value_wrapper_mode(1); Now is only active in python. All the other languages are using the old resolution, but they can also use the "valuewrapper"/"novaluewrapper" features to fix some of the old broken cases. Note, however, that not all the broken cases can be solved in that way. The new mechanism seems to be working fine in perl, ruby and tcl, but failing in some typemaps in java. Hence, is upto the language maintainer to test it, and decide to enable it or not. Look at the valuewrapper_opaque.i for examples. - Fix more SwigValueWrapper cases when the new mechanism is active. Now it also check for local typemap variables, see valuewrapper_opaque.i for an example when this is needed. But again, this extra checking will only be activated when using the new value wrapper mode. - [Python] Fix variable wrapping of classes with private assign operators. It should be easy to fix in all the other modules, instead of checking if (!Getattr(n,"immutable")) ... you need to verify if (is_assignable(n)) ... Look at the private_assign.i for an example. 10/18/2004: mmatus - %features "director"/"nodirector" now work as expected. - General fixes in %feature to resolve function decl properly, %feature("hello") foo(); char foo() -> f() // was working char *foo() -> f().p // it wasn't - Template + specialization + default template args now is working, (don't confuse with template + default arg values, that was solved before), now this ugly case is working: template > struct Vector { Vector(T a){} }; template <> struct Vector { Vector(){} int foo() { return 0; } }; %template(V_c) Vector >; %template(V_i) Vector; // picks Vector > %template(V_d) Vector; // picks the specialization this is needed for automatic STL support (later will be). - Fix the template + typedef errors in test-suite, which probably will fix another group of strange template + namespaces + typedefs errors. - %warnfilter is working better now, parser.y tries to use them when needed. - **** New default type resolution method (stype.c) ***** It preserves the original mixed types, then it goes 'backward' first deleting the qualifier, then the inner types, for example: typedef A *Aptr; const Aptr&; r.q(const).Aptr -> r.q(const).p.SWIGTYPE r.q(const).p.SWIGTYPE -> r.p.SWIGTYPE r.p.SWIGTYPE -> r.SWIGTYPE r.SWIGTYPE -> SWIGTYPE enum Hello {}; const Hello& hi; r.q(const).Hello -> r.q(const).enum SWIGTYPE r.q(const).enum SWIGTYPE -> r.enum SWIGTYPE r.enum SWIGTYPE -> r.SWIGTYPE r.SWIGTYPE -> SWIGTYPE int a[2][4]; a(2).a(4).int -> a(ANY).a(ANY).SWIGTYPE a(ANY).a(ANY).SWIGTYPE -> a(ANY).a().SWIGTYPE a(ANY).a().SWIGTYPE -> a(ANY).p.SWIGTYPE a(ANY).p.SWIGTYPE -> a(ANY).SWIGTYPE a(ANY).SWIGTYPE -> a().SWIGTYPE a().SWIGTYPE -> p.SWIGTYPE p.SWIGTYPE -> SWIGTYPE before it always stops after finding ref/pointer/enum/array/etc. Now, then, you can define (use and apply) 'higher' typemaps such as: %typemap(in) SWIGTYPE* const& %typemap(out) char FIXSIZE[ANY] %typemap(in) SWIGTYPE* const& %typemap(in) const enum SWIGTYPE& %typemap(in) SWIGTYPE[ANY][ANY] %typemap(in) const char (&)[ANY] It is possible with this change that previous typemaps that were defined (but ignored), now will start to work. Also, it is necessary check for the '%typemap(varin) SWIGTYPE[]', before it was usually not defined (but char[] was), and that can produce some inconsistencies. *** POTENTIAL INCOMPATIBILITY *** This change was needed for STL, since std::vector std::vector, etc, will always generate methods that mix const references with the vector type. Now that is working, all the std::container specialization will not be needed anymore, well, in theory. In the practice, everythin is working as before until the proper mixed types are defined and the libraries simplified to use them. - Change the behavior of extern "java"/"fortran"/"etc", now swig produces a warning, and use extern "C" instead. The warning can also be disable with the "-w 313" flag. (WARN_PARSE_UNDEFINED_EXTERN). - SwigValueWrapper is now more selective (lang.cxx). [Perl/Tcl] - Fix some typemaps (perl/tcl) to work properly with SwigValueWrapper. This was not a problem with SwigValueWrapper, but with the typemaps that now are safe to use with %apply. [Python] - Fix %callback/%pythoncallback work now as before after the def args changes. Also, %callback now is an alias for %pythoncallback, so, they do the same. [Python/Ruby] - %callback is more usable and uniform: %callback("%s_cb") foo(); // for both, python/ruby %callback("%s_cb"); // for both, python/ruby %callback(1) foo(); // only in python. 10/17/2004: arty [OCAML] - Tweak to enum typing for soundness in the presence of multiple modules. - global functions are now unambiguous in multiple loaded modules. - Fixed test case code to build multimodule test cases correctly. - There is no way to share overload resolution across modules because of soundness issues. If the user wants to call some function foo from an arbitrary module bar, they will have to use Bar._foo to call it correctly. Later I will fix the camlp4 module to do something clever in this case. - Promided performance overhaul of class mechanism. - Removed symbol hack for ocaml-3.07 and below which is not needed for ocaml-3.08 and above. 10/16/2004: wuzzeb (John Lenz) [CHICKEN] - Completly change how chicken.cxx handles CLOS and generic code. chicken no longer exports -clos.scm and -generic.scm. The clos code is exported directly into the module.scm file if -proxy is passed. - The code now always exports a unit. Running the test-suite is now majorly broken, and needs to be fixed. - CLOS now generates virtual slots for member variables similar to how GOOPS support works in the guile module. - chicken no longer prefixes symbols by the module name, and no longer forces all names to lower case. It now has -useclassprefix and -closprefix similar to how guile handles GOOPS names. 10/16/2004: wsfulton Templated functions with default arguments working with new default argument wrapping approach. The new approach no longer fails with the following default argument pattern (previously failed with some primitive types, like unsigned primitive types): template int foo(const T& u = T()); %template(foo) foo; This relies on the templated function overloading support just added, so all the combinations of overloading by template parameters and normal parameters as well as overloading with default parameters works. 10/16/2004: wsfulton Added support for the large range of templated function overloading that C++ supports. - Overloaded templated functions, eg template int overload(T t); template int overload(T t, const T &r); - Fixes where the templated type is not used in the parameter list, eg template void xyz(); template<> void xyz(); - Fixes for overloading of plain functions by a templated function: void abc(double d); template void abc(T t); - Overloading by templated parameters fixed: template void foo(T t) {} template void foo(T t, U u) {} %template(foo) foo; - All combinations of the above also working including specializations, eg: void abc(double d); template void abc(T t); template<> void abc(double t); template<> void abc(int t); 10/16/2004: wuzzeb (John Lenz) - Remove the ability to share type information by using c linking. All type sharing happens through a global variable in the target language. + Remove SWIG_NOIMPORT, SWIG_RUNTIME, and related defines. + Deprecate -runtime, -noruntime command line options + Update test-suite common.mk to correctly build multicpptest + Remove reference to precommon.swg + Update the guile_gh interface to share data by a global var instead of c linkage. - Remove Advanced.html, since everything in it is now obsolete 10/09/2004: mmatus - Split the python std/STL C++ library files, now all the language independent definitions are under the directory Lib/std and hence, can be used from other languages. - Add more documentation to the Python STL, and clean unnecessary code. - Add initial C99 complex support, and some fixes for long double. 10/08/2004: mmatus - Fix the SwigValueWrapper for opaque types, now it is applied for opaque templates and classes, for which we don't know if there is or not a default constructor, ie struct A { A(int); }; Still, if you know that you class has a default constructor, and for some very very particular reason you want to avoid the SwigValueWrapper, and you don't want or can't expose the class to swig, now you can say %feature("novaluewrapper") A; class A; or the other way around, if the class has a default constructor, but you want to use the value wrapper, you can say %feature("valuewrapper") A; struct A { A(); .... }; - Fix for char > 128, ie const char tilde_a = '\341'; - Add patch 1041858 for $lextype, which carries the literal type of a symbol. See lextype.i in the test-suite for more details. 10/07/2004: wsfulton {Ruby, Java] Fix director + 'empty' throws struct A { A() throw(); virtual ~A() throw(); int foo() throw(); }; 10/06/2004: wuzzeb (John Lenz) [TCL] - Fix bug reported by William A. Hoffman propagating clientdata between modules. Added clientdata_prop.multicpptest to check for this bug. The fix involved the following changes: + SwigType_clientdata_collect does not need to check types in r_resolved because we only want to propagate clientdata to typedefed classes, and r_mangled already takes care of typedefs. + SWIG_TypeRegister now copies the clientdata field correctly + Move SWIG_Guile_PropagateClientData function from guile module into common.swg, because we need to call it from both guile and tcl. + Add base_names to swig_class to delay the lookup of bases. SWIG now exports the base names and only when the base swig_class is needed is SWIG_TypeQuery(name)->clientdata looked up. - conversion_ns_template testsuite test was failing because the name of the wrapped constructor function was not calculated correctly for structs. Fixed. 10/06/2004: wsfulton Fixes for default arguments used in directors - in virtual methods and director constructors. 10/06/2004: mmatus Fix the __cplusplus macro, and bug 1041170. Now it is working as supposed, ie, you can safely use #ifdef __cplusplus ... all over swig, including inside %defines and %{ %} bodies. *** POTENTIAL INCOMPATIBILITY *** The old trick of using #if __cplusplus doesn't work any more. So, if you have your own typemaps using that syntax, you will need to migrate them to use "#ifdef __cplusplus". 10/05/2004: wuzzeb (John Lenz) - Reorganize how runtime type information is stored and shared between modules. For chicken and mzscheme, I removed the ability to use runtime libraries, while perl, tcl, python, and ruby default to using the new method but can go back to the old method by declaring SWIG_ALLOW_RUNTIME. - line 582 in mzscheme.cxx was generating a segfault on imports.multicpptest, so I fixed it. 10/05/2004: wsfulton Fixes for %extend and overloaded static methods with default arguments. 10/05/2004: mmatus - [python] Fix director + method with 'empty' throw, ie struct A { virtual int foo() throw(); }; other languages should also easy to fix, look for Getattr(n,"throw") in python.cxx. - Fix director + destructor with 'empty' throw struct A { virtual ~A() throw(); }; - Now SWIG_FEATURES parse all and the same options you can pass to swig in the command line. - New command line flag: -features , as in swig -features autodoc=3,director ie, any global feature can be initialized from the command line. This is mainly for testing, but users can also take advantage of it. 10/04/2004: mmatus - Properly qualify type in syntax as 'long(2)' or 'Foo()', this solve old problem with default args, and probably other problems around. However, the default arg problem was also already solved by William (see bellow). - Fix feature_set and feature_get methods. Before they look from particular to general and keep the first feature found. This didn't work well with templates. Now the methods look from general to particular, and override any found feature. - Previously a feature could not be applied to constructors or destructors that weren't explicitly declared in the class. This is now fixed, for example: %feature("featurename") Foo() "..." %feature("featurename") ~Foo() "..." class Foo { // implicit Foo() and ~Foo() }; - Fix missing features for default const/dest, by really 'creating' the methods and applying the features. - Fix return_const_value.i case by adding SwigValueWrapper specialization. - Fix %extend + overload, including overloading actual class methods. - Adding more cases in related files in the test-suite. 10/04/2004: wsfulton Changes to the way default arguments are wrapped. Previously a single method was generated for each method that had default arguments. If a method had 5 arguments, say, of which 1 had a default argument then the call to the wrapped method would pass 5 arguments. The default value was copied into the wrapper method and used if the scripting language passed just 4 arguments. However, this was flawed as the default argument sometimes does not have global access, for example SWIG would generate code that couldn't compile when wrapping: class Tricky { public: void foo(int val = privatevalue); void bar(int val = Tricky::getDefault()); private: static int getDefault(); enum { privatevalue = 200 }; }; Also bugs in resolving symbols generated code that wouldn't compile, for example (probably fixable though): namespace Space { class Klass { }; Klass constructorcall(const Klass& k = Klass()); } The approach also does not work for statically typed languages (C# and Java) as these languages do not allow methods to have variable number of arguments. Although C# has a mechanism to pass a variable number of arguments they must be of the same type and are more like varargs. The new approach solves the above problems and wraps methods with default arguments as if the method was overloaded. So SWIG will now treat void foo(int val=0); as if it had parsed: void foo(int); void foo(); The code generated is then exactly the same as if SWIG had parsed the two overloaded methods. The scripting languages count the arguments passed and call the appropriate method, just like overloaded methods. C# and Java are now able to properly wrap methods with default arguments by generating extra methods, again as if the method was overloaded, so for: void bar(string s="hello", double d=10.0, int i=0); the following proxy methods are generated: void bar(string s, double d, int i); void bar(string s, double d); void bar(string s); void bar(); The new approach comes with a couple of minor knock on effects. 1) SWIG support for default arguments for C (not C++) code no longer works. Previously you could have this interface: %{ void foo(int val); %} void foo(int val=0); and call the wrapped method from a scripting language and pass no arguments whereupon the default of 0 was used. You can get the same behaviour for C code by using the "default" typemap: %typemap(default) int val "$1 = 0;"; %{ void foo(int val); %} void foo(int val); or you could of course compile your code as C++ if you want C++ features :) : %{ void foo(int val=0); %} void foo(int val=0); A couple of SWIG's libraries used this C extension and these have been modified to use the "default" typemap. The "default" typemap is thus unchanged (and still is not and is not fully supported by C# and Java, and is likely to remain so). 2) All features (%feature, %rename, %ignore etc) no longer work as if the method with default arguments is just one method. For example, previously %ignore foo(int); would have ignored the method completely. Now it will only ignore foo(int) but not the extra foo() method. Instead use: %ignore foo; to ignore them all. or %ignore foo(int); %ignore foo(); This of course allows one to fine tune the wrapping, for example one could use: %rename(fooint) foo(int); %rename(foodefaults) foo(); void foo(int val=0); and call them from any language like so: fooint(200) foodefaults() or for example ignore the extra overloaded method, so the defaults cannot be used: %ignore foo(); void foo(int val=0); *** POTENTIAL INCOMPATIBILITY *** 10/2/2004: mmatus [Python] - More cleaning up and uniformation on the Python Lib - Added Robin's docstring patch, plus some fixes, plus some extensions, see autodoc.i example in the test-suite, and try using %feature("autodoc","extended"). This patch is not a complete solution for the documentation problem, just enough to inform python about the parameter list. The expected swig documentation support is far far away yet. 10/1/2004: mmatus - Fix the %callback feature (only used in ruby and python examples, by now, but it should be generic), now member callbacks are working again - Fix wrapping of functions pointers like std::ostream& std::endl(std::ostream&); ie, the ones that return references or enums. [Python] Add the %pythoncallback directive, which is an improved version of %callback, ie, %pythoncallback(1) foo; %pythoncallback(1) A::bar; %pythoncallback(1) A::barm; int foo(int a) { return a; } struct A { static int bar(int a); int barm(int a); }; int foobar(int a, int (*pf)(int a)); in python you can use foo(2) foobar(2,foo) A.bar(2) foobar(2,A.bar) ie, no additional pointer elements are created, and the original 'foo' and 'A.bar' can be used as parameters. In the case of member fucntion however, still you need to use the special variable Class::_cb_ptr, ie: foobarm(3, a, A.barm_cb_ptr) we will try to fix this situation also, but later. [Python] Add more elements from the STL library, now you can use import std std.cout << "hello " << 123 << std.endl [Python] Fix in/out return mechanism, now swig will behave as 1.3.21 but using a python list when needed. The problem is that the types std::pair,std::vector,etc, use tuples, and they interfer with the previous inout tuple type. By using lists we solve the conflicts, swig acts as before, but returns a list when more than one parameter are using the OUT typemap. See the new inout.i example in the test-suite. *** POTENTIAL INCOMPATIBILITY FOR PYTHON MODULE *** [Python] Much better error messages for bad arguments, now you always get the argument number where the error occurred. 09/27/2004: wsfulton Patch from Bill Clarke - 1) Warning emitted when -importall and -includeall is used together, with -includeall taking precedence. 2) Ensure SWIGIMPORTED is always defined when a file is being imported with %import. Note that this is not the same as SWIGIMPORT, which gets defined in all generated wrapper files. 09/26/2004: mmatus - add %feature("exceptionclass") to identify a class used as exception. Before swig identified and marked a class using the "cplus:exceptionclass" attribute. However, the class needed to appear on an throw() statement. Now swig keeps trying to identify the exception classes, as before, but it also allows the user to mark a class by using the %feature explicitly. (mostly relevant for python and chicken) [Python] - fix -modern option + exceptions, which mix old class style with the new one. So, we always need to emit the "nonmodern" python code. - add the "python:nondynamic" feature and its handler now if you have %pythonnondynamic A; struct A { int a; int b; }; then, in the python side aa = A() aa.a = 1 # ok aa.b = 2 # ok aa.c = 3 # error, the class can not be extended dynamically. Since this is a feature, you can use %pythonnondynamic; or %pythondynamic; [ Note: %pythondynamic since deprecated ] to force all the wrapped classes to be "nondynamic" ones. The default, as in regular python, is that all the wrapped classes are dynamics. So, careful with your spelling. 09/14/2004: mmatus - Support the -I- option. - Differentiate between %include and %include "file". This fix several corner cases. [Python] Several patches: - Normalize the Lib file names: *.swg internal files, *.i user files. - Fix Char[ANY] typemaps, so they also delete any extra '\0' chars, now they behave as before (1.3.21). Still, you can use the SWIG_PRESERVE_CARRAY_SIZE macro if you need to preserve the original size (see pystrbase.swg). - Add the Char FIXSIZE[ANY] typemaps, to preserve the original C array sizes (see above). Though, you can't use them yet since %apply and arrays are not working together. - Add pyfragments.swg, now the user can add fragments to override the default ones. 09/10/2004: wsfulton Patch from Bill Clarke which fixes spurious preprocessor bug which shows on Solaris and gcc, eg: Warning(202): Could not evaluate '!defined(SWIGJAVA) && !(defined(SWIGCSHARP)' Also fixes a bug where '#if "a" == "b" == 1' wouldn't have worked 09/10/2004: wsfulton Restored multiple build directories for the test-suite. Patch from Bill Clarke. 09/06/2004: wsfulton Added the missing runtime.dsp Visual Studio project files for the import examples to work. Version 1.3.22 (September 4, 2004) ================================== 09/03/2004: wsfulton The swig.m4 macro for use with the Autoconf/Automake/Libtool has been removed and is no longer installed. Please use the new and better maintained version derived from swig.m4 in the Autoconf macro archive. See http://www.gnu.org/software/ac-archive/htmldoc/ac_pkg_swig.html and http://www.gnu.org/software/ac-archive/htmldoc/ac_python_devel.html. 09/01/2004: wsfulton [Perl] Applied patch #1019669 from Christoph Flamm. Adds support for %feature("shadow") in the same way as it works in Python. This enables one to override the generated shadow/proxy methods, including constructors and destructors. For example: /* Let's make the constructor of the class Square more verbose */ %feature("shadow") Square(double w) %{ sub new { my $pkg = shift; my $self = examplec::new_Square(@_); print STDERR "Constructed an @{[ref($self)]}\n"; bless $self, $pkg if defined($self); } %} class Square { public: Square(double w); ... }; 08/31/2004: mmatus [Python] Incompatibility reported by Bill Clarke (llib@computer.org): If you are using Sun Studio 8 (and possibly earlier versions) to compile the output produced by swig 1.3.22rc1, and you are using C++ and STL templates then you need to use either "-runtime" or "-noruntime". If you use neither of these options then you will probably get compiler errors when trying to compile the wrapper file; the error message will be like this: The name SWIG_Python_ConvertPtr[...] is unusable in static swigpy::traits_asptr[...] If you get this error message, you need to regenerate your wrapper file using 'swig -runtime' or 'swig -noruntime'. You shouldn't get this problem with Sun Studio 9. *** POTENTIAL INCOMPATIBILITY FOR PYTHON MODULE *** 08/26/2004: wsfulton [Perl] Applied #932333 from Ikegami Tsutomu. Fixes long long *OUTPUT and unsigned long long *OUTPUT typemaps in typemaps.i. 08/26/2004: wsfulton Applied patch #857344 from Art Yerkes. Workaround for autoconf bug when running 'make install'. 08/26/2004: wsfulton [Perl] Part of patch #982753 applied. This implements a %perlcode directive. It allows one to add Perl code to the generated .pm file. Works the same as %pythoncode. 08/26/2004: wsfulton [Java] Fix for directors when wrapping virtual methods with exception specifications that were not simple types. Previously code was generated that didn't compile, for example when the exception specification was a pointer. 08/25/2004: wsfulton [C#] Typemap fix for methods that return char *. The CLR would incorrectly delete the memory pointed to by char *. Also applied the same correction to the char array typemaps. 08/24/2004: wsfulton Fixes for -fmicrosoft error/warning message display: - End of file (EOF) warning messages not displaying in correct format - Some messages containing a file path were displaying a double backslash instead of a single backslash 08/23/2004: wsfulton Applied patch #1011604 submitted by Charles Schwieters. Fix for 64 bit tcl interpreters. 08/23/2004: wsfulton Fix for bug #875583 - enum forward declarations previously gave a syntax error. 08/23/2004: mkoeppe [Allegro CL] Use typemaps "ffitype" and "lisptype" to determine the FFI type specifiers from the C type. This makes it possible, for instance, to control whether a C "char" argument takes a Lisp character or a Lisp integer value. The default (taking Lisp characters) is done by these built-in typemaps: %typemap(ffitype) char ":char"; %typemap(lisptype) char "character"; If char means an integer instead, use these typemaps: %typemap(ffitype) char ":char"; %typemap(lisptype) char "integer"; 08/22/2004: wsfulton As discussed in bug #772453, the SWIG library directory is now installed into a different default directory. The library used to be installed to /usr/local/lib/swig1.3. It is now in the more usual architecture independent directory and I have additionally used a version specific subdirectory as the library will rarely work with older versions of SWIG. This release will thus use /usr/local/share/swig/1.3.22 by default, which can be tailored as before using './configure --swiglibdir'. 08/17/2004: mkoeppe [MzScheme] Add support to create native MzScheme structures from C structures. To convert a C structure to an MzScheme structure, use the new runtime macro SWIG_NewStructFromPtr in a typemap. Patch from Dmitriy Zavin. 08/12/2004: wsfulton Patch #837715 from Ben Reser to correctly detect Python lib directory on 64 bit systems. 08/12/2004: wsfulton [C# and Java] Prevent memory leaks in the case of early return from wrapper methods using const std::string & parameters. Modified Mark Traudt patch #951565. 08/12/2004: wsfulton Bug #943783 with patch fixes php char * out typemap NULL values. 08/03/2004: Ahmon Dancy [allegrocl] Additional case mode fixes. Also, make sure foreign types are exported. 07/24/2004: mkoeppe [Guile] In -scm mode, SWIG modules now exchange their pointer type information via the Guile interpreter. It is no longer necessary to build a runtime library or to use -noruntime and -runtime etc. The module (Swig swigrun) which was introduced in the change of 05/17/2004 is no longer automatically built. If you need it, run SWIG on the interface file swigrun.i. 07/23/2004: wsfulton [C#] Bug #917601 Mapping C++ bool fix from Mark Traudt 07/23/2004: wsfulton RPM fixes for latest CVS version including removal of runtime library. 07/23/2004: wsfulton Patch #908955 from Robert H De Vries. RPM file generation fix for Fedore Core 1 and Redhat AS2.1. 07/12/2004: wsfulton Patch #864689 from Robin Dunn: This patch corrects two problems in the XML output of SWIG: 1. There were often extra '/>\n' in the output. 2. value attributes were output with '\n' in them but since that is not technically legal most (all?) XML parsers will strip them out. Replacing the '\n' with the ' ' entity reference solves this as that is legal and XML parsers will convert it to a '\n' when reading the values back in. This patch also adds a new global command line option that will allow the parse tree to be written out in XML *after* some other language module has been run, in order to be able to get extra info that the language module puts in the tree. In this way the XML is a post-processed version of the tree rather than a pre-processed version. Command line option is -dump_xml or -xmlout 07/12/2004: wsfulton [Java] Patch from Scott Michel to fix typesafe enums and proper enums with directors. 07/12/2004: wsfulton HTML documentation (makechap.py) file generator missing end of line patch #908951 from Robert de Vries. 07/08/2004: wsfulton The deprecated runtime library build has been removed. This also removes the dependency on Libtool. Libtool is no longer required to build SWIG. The associated -ldflags SWIG commandline option has also been removed. The examples and test-suite testcases that used the runtime library have been updated to use the replacement approach to using SWIG across multiple modules, that is they use the -noruntime and -runtime commandline options, see Modules.html. Effectively they build their own runtime libraries using -runtime. The examples are import and import_template. The test cases are in the imports and template_typedef_import directories. Anyone who wants the original runtime libraries can either run the test-suite or build the examples and use the appropriate shared object/DLL that is generated with the -runtime commandline option. For example libimports_runtime.so (Python calls it lib_imports_runtime.so) is generated after running the 'make imports.multicpptest' testcase in the Examples/test-suite/ directory. Or use libruntime.so / runtime.dll after building the import examples in Examples//import. 07/07/2004: mkoeppe [Allegro CL] Convert character and string literals in constants to CL syntax. Fix FF:DEF-FOREIGN-CALL for mixed-case C functions. 06/27/2004: wsfulton [Java] New feature for Java exceptions with format %javaexception(exceptionclasses). This feature is a slight enhancement to %exception and the only difference is the addition of the exception classes which are generated into a throws clause. The 'exceptionclasses' is a comma separated list of classes which will be added to the associated proxy method's throws clause. The 'exceptionclasses' are specified like the exception classes in the 'throws' attribute in the typemaps. This feature should be used for correctly handling checked exceptions thrown from JNI code. For example: %javaexception("java.lang.Exception") throwException %{ ... convert a std::logic_error into a java.lang.Exception using JNI code ... %} #include void throwException() { throw std::logic_error("Logic error!"); } will generate a method with a throws clause in the module class: public static void throwException() throws java.lang.Exception { ... } 06/27/2004: wsfulton [C#] New %csconstvalue(value) feature directive for use with constants and enums. This works the same way as %javaconstvalue. For C#, this directive is the only way that one can fix wrapping of C/C++ enums with proper C# enums if the enum item's initialiser cannot compile as C# code. This is because Java enums can use a call into C code to initialise the enum item, whereas in C#, the enum value must be a compile time constant. That is, using %csconst(0) cannot be used in C# to initialise the C# enum item via a PINVOKE call. 06/27/2004: wsfulton [Java] New %javaconstvalue(value) feature directive for use with constants and enums. Sometimes the use of %javaconst(1) will produce code that won't compile under Java. If a compile time constant is required, %javaconst(0) is not an option. The %javaconstvalue directive achieves this goal and the value specified is generated as Java code to initialise the constant. For example: %javaconst(1); %javaconstvalue(1000) BIG; %javaconstvalue("new java.math.BigInteger(\"2000\")") LARGE; %javaconstvalue(10) bar; %{ const int bar = 10; %} %inline %{ #define BIG 1000LL #define LARGE 2000ULL enum Foo { BAR = ::bar }; %} Generates: public interface exampleConstants { public final static long BIG = 1000; public final static java.math.BigInteger LARGE = new java.math.BigInteger("2000"); } public final class Foo { public final static Foo BAR = new Foo("BAR", 10); ... } Previously, none of BIG, LARGE or BAR would have produced compilable code when using %javaconst(1). 06/27/2004: wsfulton %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; 06/27/2004: wsfulton %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); 06/06/2004: wuzzeb (John Lenz) [Chicken, Guile] - Created the Examples/test-suite/schemerunme directory, which holds all the runme scripts for guile and chicken (and possibly mzscheme...). The guile and chicken _runme files then (load "../schemerunme/foo.scm"). - In chicken module, fix a few bugs invlolving dynamic casts. 06/03/2004: wsfulton Patch to fix wrapping of templated methods. ISO compliant compilers, like Comeau and GCC-3.4.0, don't like the template specifier that SWIG was generating when calling the method. This fix may break some non standard compliant compilers, for example, Sun workshop compilers prior to version 6.2.p2. Patch submitted by Bill Clarke. 06/03/2004: wsfulton [Java, C#] Undocumented special variable $imclassname removed. New special variable $module is replaced by the module name, as specified by %module or -module commandline option. $imclassname can be created from $module. 06/03/2004: wsfulton [C#] Same as for Java below. The new typemaps are named differently, namely, csbody and csbody_derived. The deprecated typemaps are csgetcptr and csptrconstructormodifiers. *** POTENTIAL INCOMPATIBILITY FOR C# MODULE *** 06/03/2004: wsfulton [Java] Typemap changes for the Java proxy / typewrapper and enum classes. A new typemap called javabody contains the essential support code for generation into the body of these classes. There is also a new javabody_derived typemap which is used instead for wrapped classes that have a wrapped base class. The code is basically, the getCPtr() method and swigCPtr and swigCMemOwn member variables. These used to be hard coded with no way to modify the code. The introduction of this typemap makes it possible for the user to tailor nearly every aspect of the code generation. The exception now is the code for director classes. The javagetcptr and javaptrconstructormodifiers typemaps are deprecated and are no longer used as the code that these generated can be put in the more flexible javabody and javabody_derived typemaps. *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE *** The following macros contributed by Scott Michel may help you upgrade if you have used the javagetcptr typemap: /* Utility macro for manipulating the Java body code method attributes */ %define SWIGJAVA_ATTRIBS(TYPENAME, CTOR_ATTRIB, GETCPTR_ATTRIB) %typemap(javabody) TYPENAME %{ private long swigCPtr; protected boolean swigCMemOwn; CTOR_ATTRIB $javaclassname(long cPtr, boolean cMemoryOwn) { swigCMemOwn = cMemoryOwn; swigCPtr = cPtr; } GETCPTR_ATTRIB static long getCPtr($javaclassname obj) { return (obj == null) ? 0 : obj.swigCPtr; } %} %typemap(javabody_derived) TYPENAME %{ private long swigCPtr; CTOR_ATTRIB $javaclassname(long cPtr, boolean cMemoryOwn) { super($moduleJNI.SWIG$javaclassnameUpcast(cPtr), cMemoryOwn); swigCPtr = cPtr; } GETCPTR_ATTRIB static long getCPtr($javaclassname obj) { return (obj == null) ? 0 : obj.swigCPtr; } %} %enddef /* The default is protected getCPtr, protected constructor */ SWIGJAVA_ATTRIBS(SWIGTYPE, protected, protected) /* Public getCPtr method, protected constructor */ %define PUBLIC_GETCPTR(TYPENAME) SWIGJAVA_ATTRIBS(TYPENAME, protected, public) %enddef /* Public getCPtr method, public constructor */ %define PUBLIC_BODYMETHODS(TYPENAME) SWIGJAVA_ATTRIBS(TYPENAME, public, public) %enddef 06/03/2004: wsfulton [Java, C#] The contents of the class modifier typemaps and pragmas have changed. They must now include the class type. Previously 'class' was hard coded. This change enables flexibility into what type of class is generated, for example the proxy class could be an interface instead of a class. For Java this affects the javaclassmodifiers typemap and the jniclassclassmodifiers and moduleclassmodifiers pragmas. For C# this affects the csclassmodifiers typemap and the imclassclassmodifiers and moduleclassmodifiers pragmas. Unless you have overridden the default versions of these typemaps or pragmas, you shouldn't be affected. However, if you have, upgrading is easy, for example class Foo {}; %typemap(javaclassmodifiers) Foo "public final" must now be: class Foo {}; %typemap(javaclassmodifiers) Foo "public final class" *** POTENTIAL INCOMPATIBILITY FOR C# MODULE *** *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE *** 05/31/2004: wsfulton Fix for C++ exception specifications that are references. Problem reported by Oren Miller. Also improves the generated exception declarations in the catch handler for pointers - a pointer is used instead of a reference to a pointer. Added default throws typemaps for SWIGTYPE &, SWIGTYPE * and SWIGTYPE[ANY] (Java and C#). 05/31/2004: wsfulton [Java, C#] Some minor typesafe enum improvements, including storing the name of the enum item. The toSring() / ToString() methods are overridden to return this name. 05/30/2004: wuzzeb (John Lenz) [Chicken] - Update how examples and the test suite are built. - Symbol names are no longer converted to lower case - Added union_runme.ss, which was copied and modified from the guile module 05/26/2004: lballabio (Luigi Ballabio) Committed on behalf of Marcelo (who still has problems with the SourceForge CVS.) Added Python typemaps for FILE* with (Python-only) test. 5/24/2004: dancy * Allegro CL module: Now using some macros (defined in Lib/allegrocl/allegrocl.swg), swig-defconstant and swig-defun, for defining constants and foreign functions. This makes the generated file a bit neater. Now strips a layer of parenthesis from constants. Uses (* :void) instead of :foreign-address now. 05/20/2004: wsfulton Unnamed enum global variables are now supported in addition to the recently added support for unnamed enum member variables. For example: struct Foo { enum { enum1, enum2 } MemberInstance; }; enum { enum3, enum4 } GlobalInstance; The int typemaps are used for wrapping the get/set accessor methods. If the sizeof an enum is not the same size as an int then setting the variable will silently do nothing as the casts cannot be easily and portably generated. If you need to solve this highly obscure situation, write the assignment using the %exception feature. 05/20/2004: wsfulton [C#] C# enum wrapping mods. Similar to the Java module, enums can be wrapped using one of 3 approaches: 1) Proper C# enums - use %include "enums.swg" 2) Typesafe enums - use %include "enumtypesafe.swg" 3) Simple constant integers (original approach) - use %include "enumsimple.swg" See each of these files for further details. Each of these files use typemaps and a new feature to control the generated code. The feature is: %csenum(wrapapproach); where wrapapproach should be one of: "proper", "typesafe", "typeunsafe" or "simple". [No implementation deemed necessary for type unsafe enums]. The default approach is proper C# enums. Anonymous enums are always wrapped by constant integers. *** POTENTIAL INCOMPATIBILITY FOR C# MODULE *** 05/20/2004: wsfulton [Java] Java enum support added. There are now 4 ways in which enums can be wrapped: 1) Proper Java enums - use %include "enums.swg" 2) Typesafe enums - use %include "enumtypesafe.swg" 3) Type unsafe enums (constant integers) - use %include "enumtypeunsafe.swg" 4) Simple constant integers (original approach) - use %include "enumsimple.swg" See each of these files for further details. Each of these files use typemaps and a new feature to control the generated code. The feature is: %javaenum(wrapapproach); where wrapapproach should be one of: "proper", "typesafe", "typeunsafe" or "simple". The default typemaps will handle enums that may or may not have specified initial values, for example ten is specified: enum Numbers { zero, ten(10) }; However, the amount of generated Java code can be cut down, by modifying these typemaps if none of the enums have initial values (proper Java enums and typesafe enums approach). The default approach is typesafe enums. Anonymous enums are always wrapped by constant integers. *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE *** 05/11/2004: wsfulton [Java, C#] Fix bug using %rename on enum items and when using %javaconst(1) / %csconst(1) For example, the following used to generate code that wouldn't compile: %rename(Obj) Object; enum Grammar { Subject, Object }; 04/28/2004: wsfulton [Java, C#] Minor fixes when using combinations of the javainterfaces, javabase, csinterfaces and csbase typemaps. 05/18/2004: wsfulton [Java] JVM link failure on some systems fixed when using std_vector.i. Also adds default vector constructor for use from Java. 05/17/2004: mkoeppe (Matthias Koeppe) [Guile] New runtime functions SWIG_PointerAddress, SWIG_PointerType, SWIG_IsPointerOfType, SWIG_IsPointer. [Guile] In -scm mode, wrap several SWIG runtime functions and export them into the module (Swig swigrun). The runtime module is now built with "module" linkage. [Guile] GOOPS proxy objects now also print the pointer address of the C object. 05/14/2004: lyle Added Kou's patch for the Ruby %import directive so that modules with "nested" names are handled properly. Consider an interface file foo.i that has this %module declaration at its top: %module "misc::text::foo" Now consider another interface file spam.i that imports foo.i: %import foo.i Before this patch, this would result in the following code being generated for spam_wrap.c: rb_require("misc::text::foo"); With this patch, however, you'll get the correct path name for the call to rb_require(), e.g. rb_require("misc/text/foo"); See SourceForge Bug #928299. 05/12/2004: wsfulton Patch for emitting directors when %feature("director") specified for a class with no virtual methods, but does have a virtual destructor. Submitted by Kevin Smith. 05/06/2004: mkoeppe (Matthias Koeppe) New SWIG runtime function SWIG_TypePrettyName, which returns an unmangled type name for a swig_type_info object. [Guile]: Use it for printing pointer objects. 05/03/2004: dancy (Ahmon Dancy) * Lib/allegrocl/allegrocl.swg: Updated comments about identifer conversion. * Sources/Modules/allegrocl.cxx: Register /dev/null for "header" target. Also, disregard "const" qualifiers during type conversion. 05/02/2004: wuzzeb (John Lenz) [Chicken] Fix bug 782468. To fix this bug, the runtime code has been rewritten, and pointers are now represented as a C_SWIG_POINTER_TYPE. Chicken version > 1.40 is now required! * Typemap incompatibility: typemaps no longer use chicken_words. If a typemap needs some space, it should just call C_alloc * argout typemaps no longer use the /* if ONE */ construct to build an output list. A SWIG_APPEND_VALUE macro, exactly like guile and mzscheme is now used. 04/25/2004: mkoeppe (Matthias Koeppe) [Guile] In the generated GOOPS code, don't create methods that would not specialize any arguments; simply re-export the primitive functions. (This is a performance optimization which reduces load time and execution time.) [Guile] In -gh mode, fix the "too many initializers" error which was caused by an incompatible swig_type_info layout. [Guile] The typemap for FILE * in ports.i now also accepts a regular FILE * pointer object. Also a bug with Scheme file ports that are open for input and output has been fixed. 04/25/2004: wsfulton Change entry 03/21/2004 revoked. The change introduced another inconsistency (reference typemaps beings used instead of pointer typemaps for member variables as well as static member variables and global variables for some languages, but only for C++ and not C). This would break user's current typemaps and introduce further inconsistencies. Alternative solution required and being discussed. 04/10/2004: mmatus (Marcelo Matus) Added the -directors flag. This enables the director mode for the interface and all the classes that don't set the "feature:nodirector" explicitly. You can use this in your module if you want to use the director feature in all your classes, but it is most intended for testing purposes, like: make check-python-test-suite SWIG="../../../swig -directors" make check-ruby-test-suite SWIG="../../../swig -directors" make check-java-test-suite SWIG="../../../../swig -directors" These commands will run the entire test-suite using directors, and not only the specific 'directors_*' cases. This should be done from time to time. 04/10/2004: mmatus (Marcelo Matus) [python] Added support for std::wstring and wchar_t, for compiler and python versions that support them. When needed, use %inlcude std_string.i // 'char' strings %inlcude std_wstring.i // 'wchar_t' strings 04/10/2004: mmatus (Marcelo Matus) [python] Fix the default behaviour (seg. fault) when an inplace operator (+=,-=,...) was wrapped, as reported by Lucriz (lucriz@sitilandia.it), when the most common form was used: A& A::operator+=(int i) { ...; return *this; } ^^^^ ^^^^^^ ie, an object is returned and its contains the same 'this' value than the input object, which is deleted after the operation "a += b", leaving the result with no real object, but a seg. fault. To fix it, we needed to introduce a new feature and use an old one: %feature("self:disown") A::operator+=; %feature("new") A::operator+=; here, "self:disown" disable the ownership of the 'self' or input object, and the "new" feature transfers the ownership to the result object. The feature/solution could also be used in other languages that use gc and implement the inplace operators, or other operators, in a similar way. *** POTENTIAL INCOMPATIBILITY FOR Python MODULE *** If you already are using the inplace operators in python, and you implemented some kind of workaround to the problem fixed here, it is possible you could end with 'free' objects that never get deleted. If that is the case, and you want to disable the current fix, use: %feature("self:disown","") A::operator+=; %feature("new","") A::operator+=; 04/07/2004: cheetah (William Fulton) [C#] C++ enums are no longer wrapped by integers, they are now wrapped by C# enums. For Example, given C++: enum AnEnum { foo, bar }; typedef AnEnum AnEnumeration; void something(AnEnum e, AnEnumeration f); The following is generated: public enum AnEnum { foo, bar } public static void something(AnEnum e, AnEnum f) {...} Note that a global enum like AnEnum above is generated into its own file called AnEnum.cs. Enums defined within a C++ class are defined within the C# proxy class. Some of the typemaps for modifying C# proxy classes also work for enums. For example global enums can use %typemap(csimports) to add in extra using statements. Global enums and class enums can use %typemap(csclassmodifiers) to make the enum private, public etc. %typemap(csbase) to change the underlying enum type (enum base) If we add this for the above example: %typemap(csclassmodifiers) AnEnum "protected" %typemap(csbase) AnEnum "long" the following is generated: protected enum AnEnum : long { foo, bar } *** POTENTIAL INCOMPATIBILITY FOR C# MODULE *** 04/07/2004: cheetah (William Fulton) Seg fault fix for empty enums, like enum Foo {}; 03/21/2004: mmatus [Note: this change revoked on 04/25/2004] [Python] Makes the following 'var' cases more uniform: std::string ga; struct A { static std::string sa; std::string ma; }; now the three variables (ga, sa, ma) can be assigned as: cvar.ga = "hello"; A.sa = "hello"; a.ma = "hello"; ie, now 'ma' will also use a std::string typemap 'in' if defined, before it was only accepting a 'p_std_string' pointer. Note, however, that 'ma' will not use the 'varin/varout' typemaps (that probably could be more natural), but it will pick up the 'in' typemap for const std::string& (which is easier). The changes in cwrap.c and lang.cxx will probably fix the behaviour in other languages that do not overload the membervarHandler method "too much". 03/21/2004: mmatus [Python] Disabling the default instantiations like: %template() std::pair; for all the primitive types and STL containers/classes. They are expensive, specially for pair and map, and the previous behaviour also requires the user to perform manual instantiations. Still, if the speed difference is not important, it can be re-enabled by defining the macro SWIG_STD_DEFAULT_INSTANTIATION (see std_common.i). Also, normalizing the INPUT/OUTPUT/INOUT typemaps. Now they use the same conversors than the rest of the typemaps, and you can use them for std::pair, std::string and all the other STL types, like in: void p_inoutd(std::pair *INOUT); Added the attribute.i and implicit.i files with macros to transform functions pairs like 'set_x'/'get_x' (or 'T& x()'/'const T& x() const') into an attribute, and allowing the use of implicit constructors in typemaps (see the files for more details). 03/21/2004: mkoeppe [Guile] Fix the documentation strings of functions with anonymous arguments. 03/18/2004: mmatus [Python] More general std_string.i interface. Now you can wrap it using %template(string) std::basic_string; and use the std::string as a base class: struct A : std::string { }; But more important, swig will recognize both std::basic_string and std::string as the same type. 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 mechanisms (like in python). Use it like: %feature("ref") RCObj "$this->ref();" %feature("unref") RCObj "$this->unref();" And the class RCObj, and all the derived ones, will perform the right ref/unref calls when a new pointer is returned to the target language, or when the target language attempts 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; and a specialized 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 >; %template(vector_pii) std::vector >; - The empty template instantiation %template() std::vector; 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& a); where the proper typemap is applied to 'a', but no std::vector proxy is generated. - All the STL containers present a more uniform behavior and more complete interface declaration. The following are now supported: std::vector std::list std::deque std::set std::multiset std::map std::multimap not a container, but also supported: std::pair also, more typemaps are defined for all of them, including varin, varout, typecheck, etc. - Initial attempt to implement the STL containers considering allocators, ie: std::vector 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; 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 specialized 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 specialized", 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 struct A { %fragment("incode"{A},"header") { /* 'incode' specialized fragment */ } %typemap(in,fragment="incode"{A}) { /* here we use the 'type specialized' fragment "incode"{A} */ } }; 03/11/2004: cheetah (William Fulton) [Java] Director bug which meant that some virtual functions overridden in Java were not being called on some operating systems. Bug reported and fixed by Robert de Vries and Scott Michel. 03/02/2004: mkoeppe (Matthias Koeppe) [Guile] In -scm mode, don't forget to check the type of string arguments. 02/24/2004: cheetah (William Fulton) [C#] New commandline option -namespace . This allows one to specify a C# namespace into which all C# classes are generated. 02/23/2004: mkoeppe (Matthias Koeppe) [MzScheme] 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. [Guile] Define FUNC_NAME also in the dispatch wrapper for overloaded functions. Patch by John Lenz, SF #896255. 02/22/2004: mkoeppe (Matthias Koeppe) [Guile] In -scm mode, don't try to invoke a null destructor function. 02/20/2004: cheetah (William Fulton) Fixes so that the SWIG source will compile using the Digital Mars Compiler (formerly Symantic compiler) on Windows. Submitted by Scott Michel. 02/13/2004: mkoeppe (Matthias Koeppe) [MzScheme] New command-line argument -noinit. Use it for building the runtime library, where we don't want to define the functions scheme_initialize etc. Reported by Tim Brown, SF #891754. [MzScheme] Don't produce invalid C code when invoked with the -declaremodule option. Reported by Tim Brown, SF #891108. [Guile] Build the runtime library with passive linkage, to rename the SWIG_init function uniquely. 02/12/2004: cheetah (William Fulton) [Java, C#] Patch submitted by Bill Hoffman which prevents SWIG from crashing when a file for the typewrapper class cannot be opened. 02/11/2004: cheetah (William Fulton) [Java, C#] Overloading changes: - Methods which are overloaded in const only no longer generate Java code that won't compile - the first method parsed is used and a warning is displayed. Note that this behaviour is slightly different to the scripting languages which always uses the non-const method. - Warning messages 509 and 512 replaced by new warning number 516, which is more relevant to these statically typed languages as the overloaded methods aren't 'shadowed', they are ignored. 01/23/2004: mkoeppe (Matthias Koeppe) [Guile] Replace the "known_classes" hash table by a node attribute. Methods of classes in C++ namespaces now get the proper specializer in the GOOPS declaration. Reported by rm@mh-freiburg.de. 01/23/2004: mkoeppe (Matthias Koeppe) [Guile] Uniquify the argument names in GOOPS shadow method declarations. Reported by rm@mh-freiburg.de. 01/21/2004: sunshine (Eric Sunshine) Revived the NextStep port of SWIG. Fixed fatal problem in DohStrstr() caused by difference in strstr() implementation which made %apply become entirely dysfunctional. On NextStep, strstr("foo","") evaluates to NULL; whereas, on modern platforms, it evaluates to "foo". %apply relies extensively upon strstr("foo","") evaluating to non-NULL, therefore it failed catastrophically when faced with NextStep's strstr(). Added `bool' check to configure.in since NextStep's C++ compiler does not supply this type. swig.h now fakes up `bool' if needed. Worked around NextStep C++ compiler bug in which C++ code is disallowed inside extern "C" functions. This problem affected all language modules, since they publish hook functions of the form: extern "C" Language *swig_foo(void) { return new FOO(); } Fixed by creating a C++ wrapper: static Language *new_swig_foo() { return new FOO(); } extern "C" Language *swig_foo(void) { return new_swig_foo(); } Ensured that Swig_copy_string() is used in place of strdup() since NextStep does not supply strdup(). Fixed detection of Ruby library name and location in configure.in. Problem 1: Assumed that library always resided in Ruby's "archdir", which was correct for Ruby 1.6.x, but which is incorrect for Ruby 1.8.x, in which case the library normally resides in Ruby's "libdir". Problem 2: Assumed that the library could always be linked via "-l"+RUBY_INSTALL_NAME (where RUBY_INSTALL_NAME typically is "ruby"), however this failed for platforms, such as NextStep, which do not support shared libraries. In this case, the static library name in 1.8.x is libruby-static.a, thus -lruby-static is required. The new logic works correctly for static and shared libraries for 1.6.x and 1.8.x. Fixed detection of Perl CFLAGS in configure.in for NextStep. Detection code extracted CFLAGS from Perl's %Config hash but neglected to add a newline to the value before passing it through `sed'. NextStep's ancient `sed' discards input which is not terminated with a newline, thus Perl CFLAGS always evaluated to the empty string. 01/16/2004: cheetah (William Fulton) Tidy up in the exception handling code that is generated when C++ exception specifications are wrapped with the throws typemap. This redundant code is no longer generated: catch(...) { throw; } 01/12/2004: wsfulton on behalf of mmatus (marcelo matus) if a method uses %exception and the method requires the use of the throws typemap, the code in a throws typemap will be generated inside the try body. For example: %exception method { try { // method action $action } catch (int i) { // method int catch handler } catch (...) { // method generic catch handler } } %typemap(throws) Except %{ // throws typemap Except catch handler %} %inline %{ class Except {}; void method(int i) throw (Except); Will generate: { try { // method action try { method(arg1); } catch(Except &_e) { // throws typemap Except catch handler } } catch (int i) { // method int catch handler } catch (...) { // method generic catch handler } } As can be seen, the inner try catch block is for the throws typemaps. Previously, this was reversed so that the inner try catch block was the %exception code. In the example above, it would have been impossible to catch Except as the catch all (...) would catch the exception instead. Version 1.3.21 (January 11, 2004) ================================= 01/10/2004: cheetah (William Fulton) The output format for both warnings and errors can be selected for integration with your favourite IDE/editor. Editors and IDEs can usually parse error messages and if in the appropriate format will easily take you directly to the source of the error. The standard format is used by default except on Windows where the Microsoft format is used by default. These can be overridden using command line options, for example: $ swig -python -Fstandard example.i example.i:4: Syntax error in input. $ swig -python -Fmicrosoft example.i example.i(4): Syntax error in input. 01/09/2004: beazley Fixed [ 871909 ] simple namespace problem. This was a problem using anonymous structures in a namespace. For example: namespace ns { typedef struct { int n; } S; }; Reported by Josh Cherry. 01/09/2004: beazley Fixed some broken Perl examples. 12/28/2003: cheetah (William Fulton) [Java and C#] Fixes for wrapping covariant (polymorphic) return types. For example: struct Base { virtual ~Base(); virtual Base* copy() const = 0; }; struct Derived : Base { virtual Derived* copy() const; }; The Derived::copy proxy method returns Base not Derived. A warning is issued about this. Previously the pointer used by the proxy class was incorrectly treated as a Base* instead of a Derived*. 12/18/2003: cheetah (William Fulton) Fix so that Windows paths are displayed correctly when reporting errors. An error previously would have been shown something like: .?xample.i:14: Syntax error in input. instead of: .\example.i:14: Syntax error in input. Version 1.3.20 (December 17, 2003) ================================== 12/17/2003: beazley Last minute modifications. Perl5 module now generates shadow classes by default like all of the other modules. PHP4 wrappers no longer include "config.h". 12/14/2003: beazley Weakened warning message related to constructor names so that an unusual nested-class wrapping technique would work again (apparently it worked in some older SWIG releases). For example: class Scope { class ClassA; class ClassB; }; class Scope::ClassA { ... }; class Scope::ClassB { ... } Note: There is still some odd interaction with the SWIG symbol table/type system that will need to be looked at in a future release. Reported by Gustavo Niemeyer. 12/11/2003: cheetah (William Fulton) [Java] Protected class methods are wrapped as protected Java methods when using the dirprot director feature. This can be changed using %javamethodmodifiers to something else should the need arise, for example, private or package access. 12/11/2003: cheetah (William Fulton) [Java, C#] %javamethodmodifiers (Java) and %csmethodmodifiers (C#) operate slightly differently. Previously this feature had to be present to set the method modifiers. Now it is only used if it exists for the method being wrapped. The default is "public" as previous however, when wrapping protected director methods it is "protected". This change will not affect existing use of the %javamethodmodifiers or %csmethodmodifiers. 12/11/2003: mmatus (Marcelo Matus) This fix some recurring reports about keywords not been properly identified and warned, and it solves the problem of how to add a test file to the test-suite such that it doesn't use any keyword of all the supported languages (and doing it without compiling the test for all the supported languages, thing that is not always possible, and without requiring you to know all the supported language keywords, thing that is always impossible). So these are the changes globally speaking: - Uniform the definition of the keyword warnings through the supported languages: all the languages has now a separate file that defines the keywords or bad names: python/pythonkw.swg chicken/chickenkw.swg .... - Added keyword list for most of the languages that didn't have one (using the new separated file). - Added the "All keywords" warning support: -Wallkw option. This option allows you to include all the known keywords for all the supported languages, and can be used as: swig -Wallkw .... This will help to the process of adding a test-suite file that can be compiled in all the swig supported languages, and it will be also helpful for users who want to create multi-language libraries. And these are the detailed changes (mostly file addition): - For the languages that already have some sort of keyword warning list, move it to an external languagekw.swg file, ie: move keywords from python.swg -> pythonkw.swg move keywords from chicken.swg -> chickenkw.swg move keywords from tcl8.swg -> tclkw.swg and re-include languagekw.swg from language.swg. - For the language that didn't have a keyword list, and for the ones that I could find a list, add the languagekw.swg file, ie: csharp/csharpkw.swg java/javakw.swg php4/phpkw.swg pike/pikekw.swg ruby/rubykw.swg also add a line in language.swg to include languagekw.swg, but now it is commented!!!, like in java.swg: /* java keywords */ /* please test and activate */ //%include "javakw.swg" ie, there will be no change in how swig runs normally until the language maintainer test and uncomment that line. So, please check each languagekw.swg file (I left the link to the keyword list source for checking), and after testing, uncomment the %include line. - Added the file allkw.swg, which includes all the languagekw.swg files. For the languages that has no languagekw.swg file right now, and if they need one, add the file into the language directory, and add the corresponding include line into the allkw.swg file. - Added the -Wallkw that includes the allkw.swg file. Note that the old -lallkw.swg option couldn't be used since it include the file after it would be needed. Hopefully, the -Wallkw option will be added to the default rules in the related test-suite Makefiles, so, when creating a new test, or adding a new swig library file (like _std_deque.i), swig will warn you if you are using a bad name, considering all the language where it needs to run. Right now you can test it by using: make check-python-test-suite SWIG="swig -Wallkw" or using your favorite target language, it doesn't matter. And yes, there are several examples that are using reserved keywords, specially from csharp. *** Remember ****: the new keyword warning lists are not included by default in any of language that before didn't have one. To enable the keyword warnings as the default behavior, the inclusion of the languagekw.swg file has to be uncommented at each language.swg file. So, all the language maintainers, please check the keywords list. Also, you can add buit-in names, and not only keywords, like 'True/False' in python. Remember that you can be more specific and refer only to member names, like *::configure or *::cget (see an example in the tcl8/tcl8kw.swg file), or only global names, like ::range (see an example in the python/pythonkw.swg file. Just to be consistent, use the following codes: - Use code 314 for keyword and/or fatal bad names. - Use code 321 for buit-in and/or not fatal bad names. so, they can't be disabled/enabled independently (see python/pyhtonkw.swg for examples). **** And don't add any new test file without checking it with the -Wallkw option!! (that includes me) *****. 12/11/2003: cheetah (William Fulton) SF bug #854634 Added support for accepting the Unix directory separator '/' on Windows and the Mac in addition to the native one ( '\' on Windows). This can be used in %import, %include and commandline options taking a path, for example -I. On Cygwin, both the Windows and Unix directory separator can now be used (was '/' only). 12/10/2003: mmatus (Marcelo Matus) [python] Implementing the runtime "reprotected" director members, if you have: %feature("director") B; class Bar { public: virtual ~Bar(); virtual int hello() { return do_hello();) protected: virtual int do_hi() {return 0;} virtual int do_hello() {return 0;} }; then, at the python side import my_module class Foo(my_module.Bar): def do_hello(self): return 1 pass b = Bar() # Pure C++ Director class f = Foo() # C++ Director + python methods b.hello() # Ok, and it calls C++ Bar::do_hello() f.hello() # Ok, and it calls Python Foo::do_hello() b.do_hi() # RuntimeError, do_hi() is protected!! f.do_hi() # RuntimeError, do_hi() is protected!! b.do_hello() # RuntimeError, do_hello() is protected!! f.do_hello() # Ok, since it its redefined in python. Here Bar.do_hello is always protected, but Foo.do_hello is "public", because it is redefined in python. Before, all the 'do_hello' methods were public. This seems to be a good compromise between C++ and python philosophies, ie, all the director protected methods keep protected at the user side (C++ way) until they are redefined (python way, were all defined methods are always public). And this is not only a good compromise, it also seems to be the only way to do it :). Now ruby has native director protected members, and python pure runtime support. I guess these are the two possible extreme cases. And hopefully, they could be used as templates to modify the other languages that support directors, so they can "reprotect" the protected director members at the target language side. This finished the director protected support for the python language. Ocalm will need to add the "reprotection" later. 12/10/2003: mmatus (Marcelo Matus) The following case (reported by Lyle Johnson) was fixed: %rename(x) Foo::y(); class Foo { public: void y(); protected: int x; }; swig warned that the symbol 'x' was already defined, and the renaming fails. 'x' was not emitted, since it is protected, but it was kept in the symbol table with too much information. Now swig works for all the cases (plain, director and dirprot) again. This was fixed by allowing the parser.y to decide much closer what to do with 'x'. Before all the discarding or generation was resolved at the lang.cxx stage. Also the changes in parser.y to implement the director protected mode are now much more encapsulated, and they get disabled if the mode is not enabled. Before the deactivation was done at the generation stage (lang.cxx). By the other hand, if the director mode is enabled, and %rename is done, reusing a protected member name, there is a pathological case: %rename(x) Foo::y(); class Foo : public A { public: void y(); protected: int x; /* works */ static int x; /* works */ static void x(); /* works */ typedef void x(); /* works */ virtual void x(); /* always fails, as it should, since Foo::x() will be emitted in the director */ void x(); /* always fails, but sometimes it shouldn't, since the Foo::x() will not be emitted if it is not virtual */ }; The last case is not always right because at the parser.py stage it is not possible to decide if the protected member Foo::x() could or not conflict with the renamed Foo::y(), since Foo::x() could be virtual by inheritance. I guess this just an intrinsic limitation, and no much can be done about it without resorting into larger changes to postpone, under certain conditions, the multiply symbol detection (lang.cxx stage). So, by now, it is just considered a well known "feature" in the director protected mode. The good news is that it seems to be a rare case, and it can be avoided by the user by hiding 'x' before renaming 'y': %rename(_x) Foo::x(); %rename(x) Foo::y(); 12/08/2003: mmatus (Marcelo Matus) The virtual method detections now properly treats the following cases: namespace foo { typedef int Int; } struct A {}; typedef A B; struct Foo { virtual ~Foo() {} virtual Foo* cloner() = 0; virtual int get_value() = 0; virtual A* get_class() = 0; virtual void just_do_it() = 0; }; struct Bar : Foo { Bar* cloner(); foo::Int get_value(); B* get_class(); void just_do_it(); }; All the Foo and Bar methods are virtual. A new attribute "virtual:type" record the base polymorphic type. In the previous cases we have: type : Bar virtual:type : Foo type : foo::Int virtual:type : int type : B virtual:type : A type : void virtual:type : void This attribute is useful in languages (java+directors) that could have problems redefining Bar* Bar::cloner(). If you never had code like the above, you will see no effects. But if you have some code like that, you will see some effects since some methods that before were not properly treated as virtual, will start to act like that. This could enlarge your director classes. 12/08/2003: mmatus (Marcelo Matus) The director protected member support (dirprot) is disabled by default. It can be enable by using '-dirprot' or by adding the option to the module declaration, like: %module(directors="1",dirprot="1") my_module This module option was added to properly compile the director_protected.i and director_nested.i examples. The feature has been tested with python[2.2,2.3] and ruby[1.6.7], both at compilation and runtime, and java[j2sdk1.4.1_01], but only at compilation (my java installation doesn't run any of the director examples, olds nor news). Please test for ocaml and java. The errors reported by William and Scott were fixed, except for a warning about SWIG_JavaThrowExecption() multiply defined. I can't reproduce this error with my examples. We will wait for Scott to send us a minimal case. 12/07/2003: mmatus (Marcelo Matus) The director protected member support has been completly moved out from python.cxx, and now resides in the common lang.cxx, emit.cxx and allocate.cxx files. This means it should work for all the other languages that currently support directors, ie, python, java, ocalm and ruby. The change has been tested with python (compilation+runtime) and java (just compilation). Please add runtime tests for the missing languages and test it. The '-nodirprot' option was moved to the principal main, and can be used from all the languages. 12/07/2003: cheetah (William Fulton) [Java] Fixed and improved error checking of STRING_OUT typemaps in various.i. 12/04/2003: mmatus (Marcelo Matus) - Now the virtual members with no explicit declarator are properly identified: struct A { virtual int f() = 0; }; struct B : A { int f(); }; Here, B::f() is virtual, and the director and the virtual elimination mechanism now recognize that. - [C#] This fix also fixes the problem where 'override' was not being used on any overridden virtual method, so for struct B above, this C# code is generated: public class B : A { ... public override int f() { ... } ... } - Initial support for protected virtual methods. They are now properly emitted when using with director (python only by now). %feature("director") A; struct A { protected: virtual int f1() = 0; }; %feature("director") B; struct B : A{ protected: int f1(); virtual f2(); }; This can be dissabled by using the '-nodirprot' option. - The feature 'nodirector' is working now at the top level, so, it must work for all the languages: %feature("director") A; %feature("nodirector") A::f2; struct A { virtual int f1(); virtual int f2(); }; in this case, only 'f1' is exported to the director class. - Added director support for const TYPE& arguments (python). 12/02/2003: cheetah (William Fulton) [Java] Fix for INOUT and OUTPUT typemaps in typemaps.i for when the JNI type is bigger than the C type. For example, unsigned long (32bits on most systems) is mapped to jlong (64bits). Returned value was incorrect. Bug reported by Brian Hawley. 12/02/2003: cheetah (William Fulton) [C# and Java] Better fix for entry dated 05/11/2003. Fixes the following typemaps: Java: javabase, javainterfaces, javaimports, javaclassmodifiers, javaptrconstructormodifiers, javafinalize, javagetcptr & javacode. C#: csbase, csinterfaces, csimports, csclassmodifiers, csptrconstructormodifiers, csfinalize, csgetcptr & cscode. It also fixes bug in using arrays of C structs with arrays_java.i as reported Scott Michel. 12/02/2003: beazley [Perl] Fixed [ 852119 ] recursive inheritance in output .pm, perl5. Reported by William Dowling. 12/02/2003: beazley [Tcl] Fixed [ 755382 ] calling func(const vector& p) evaluates p[0] in interp. The Tcl type checker was improperly handling the interpreter result when type violations were supposed to be ignored. Reported by Flaviu Popp-Nowak. 11/30/2003: cheetah (William Fulton) Fixed [ 545058 ] configure's --with-tclincl has no effect 11/30/2003: cheetah (William Fulton) [Java] Fixed [ 766409 ] missing symbol SWIG_JavaThrowException during module load SWIG's internal functions are all static as there is no need for different SWIG generated modules to share any code at runtime. 11/30/2003: beazley [Tcl] Added support for C++ pointers to members. 11/28/2003: cheetah (William Fulton) Fixed [ 848335 ] Directors: #include wrapper .h file - was incorrectly adding a directory to the generated #include "foo_wrap.h" statement in some situations. 11/28/2003: cheetah (William Fulton) [Java] Fixed [ 849064 ] JAVA : Access modifier for derived class wrong. The delete() method is always public now. It used to be protected whenever a destructor was non public. An UnsupportedOperationException runtime exception is thrown instead of making delete() protected now. 11/28/2003: beazley [Perl5] Added support for C++ pointers to members. 11/28/2003: beazley Fixed [ 850151 ] PYVERSION with python2.3 in configure of SWIG 1.3.19 (Maybe). 11/28/2003: beazley Fixed [ 850666 ] #include extra line added. This should fix some problems with getting correct line numbers on error messages. 11/26/2003: beazley Fixed another one of Marcelo's evil template bugs (infinite recursion). [ 849504 ] template and typedef -> inf. recursion. 11/26/2003: beazley Fixed parsing problem with declarations like this: int *x = &somearray[0]; 11/25/2003: beazley Fixed [ 756552 ] missing default argument class scope with "|". This is really only a band-aid fix for use of class-enums in expressions. For example: class A { public: enum Flag { flag1 = 0x1, flag2 = 0x2 }; void foo(int x = flag1 | flag2); }; Note: there are still some (more subtle) cases that are broken, but hard to fix due to an issue with template expansion. Will address later. Reported by Dmitry Mironov. 11/25/2003: beazley Incorporated [ 840878 ] support for %inline { ... } (PATCH). This adds support for the following: %inline { ... some code ... } The difference between this and %inline %{ ... %} is that the enclosed text is processed by the SWIG preprocessor. This allows special macros and other processing to be used in conjunction with %inline. Contributed by Salvador Fandino Garcia. 11/25/2003: beazley Fixed [ 836903 ] C++ inconsistency (with void arguments). SWIG was having difficulty with f() vs f(void) in C++ programs. For instance: class A { public: virtual void f(void) = 0; }; class B { public: virtual void f(); // Not matched to f(void) correctly }; The parser now normalizes all declarations of the form f(void) in C++ classes to f(). This should fix a variety of subtle problems with inheritance, optimizations, overloading, etc. Problem reported by Partho Bhowmick. 11/25/2003: beazley [Perl5] Incorporated [ 841074 ] better croaking (PATCH). This fixes some problems with strings and provides some new error functions. Contributed by Salvador Fandino Garcia. 11/25/2003: beazley Fixed [ 791835 ] Default argument with cast: txt = (char *)"txt" syntax Error. The parser should now accept things like this: void foo(char *s = (char *) "Hello"); Problem reported by Claudius Schnorr. 11/24/2003: beazley [Tcl] Fixed problem with cross module linking. Previously modules referred to base classes through a global variable. Now, the module looks up base classes through the type system itself---avoiding the need to link to a global like before. Caveat: modules with base classes must be loaded before modules with derived classes. 11/24/2003: mkoeppe (Matthias Koeppe) [Guile] In -scm mode, use () to represent null pointers, as it is done in -gh mode. 11/23/2003: mkoeppe (Matthias Koeppe) Add a generated script "preinst-swig", which can be used to invoke SWIG before it has been installed. It arranges that the runtime libraries from the source directory are used. 11/23/2003: mkoeppe (Matthias Koeppe) [Guile] In -gh mode, don't forget to call SWIG_Guile_Init. Add a SWIG_contract_assert macro. 11/23/2003: mkoeppe (Matthias Koeppe) [MzScheme] Update the configure check for the dynext object to work with MzScheme 205. 11/20/2003: mmatus Fixed the include/import error reported by Kerim Borchaev, where two files with names like 'dir1/hello.i' 'dir2/hello.i' can not be include at the same time. Swig was including just the first one, assuming the second one was not a different one, since it was checking/keeping just the basename 'hello.i'. 11/19/2003: beazley Changes to the SWIG runtime library support. - The -c command line option has been renamed to -noruntime - New command line option: -runtime. When supplied, this inserts the symbol SWIG_GLOBAL into the wrapper code. This, in turn, makes all of the runtime support functions globally visible. - New library file: swigrun.i. Used to create modules for runtime library (if needed). 11/18/2003: cheetah (William Fulton) 'make srcrpm' rpmbuild fix - patch from Joe Cooper 11/18/2003: mkoeppe (Matthias Koeppe) [Guile] Change meaning of configure option --with-guile to the name of the Guile executable. The new option --with-guile-prefix can be used to specify the tree where Guile is installed. (However, usually it suffices to use the single option --with-guile-config.) When running the run tests test-suite, make sure to use the version of Guile that SWIG was configured for. 11/17/2003: mkoeppe (Matthias Koeppe) [Guile] Improvements to object-ownership management in "-scm" mode. (They do not apply to the default "-gh" mode.) * Renamed the smob type that indicates that the object can be garbage collected from "collected swig" to "collectable swig", which is more precise. * Export the destructor functions again. It is now allowed to explicitly call destructors, even for garbage-collected pointer objects. A pointer object that has been passed to a destructor is marked in a special way using a new smob type, "destroyed swig". (This helps avoid nasty memory bugs, where references to dead C objects are still held in Scheme. Moreover, the garbage collector will not try to free a destroyed object once more.) * Destructor-like functions can also mark their arguments as destroyed by applying the typemap SWIGTYPE *DESTROYED. (It calls the function SWIG_Guile_MarkPointerDestroyed.) * Functions that "consume" their objects (or that "own" them after the call) can mark their arguments as not garbage collectable. This can be done by applying the typemap SWIGTYPE *CONSUMED. (It calls the function SWIG_Guile_MarkPointerNoncollectable.) * The macro TYPEMAP_POINTER_INPUT_OUTPUT from library pointer-in-out.i creates additional typemaps PTRTYPE *INPUT_CONSUMED, PTRTYPE *INPUT_DESTROYED. They mark the passed pointer object likewise. The typemap PTRTYPE *OUTPUT creates a garbage-collectable pointer object, like %newobject does for a returned pointer. Use the new typemap PTRTYPE *OUTPUT_NONCOLLECTABLE to create a pointer object that will not be garbage collected. 11/17/2003: mkoeppe (Matthias Koeppe) [Guile] Handle $input in "freearg" typemaps. Never qualify GOOPS slot names with the class name. Handle optional arguments properly in the GOOPS methods. 11/16/2003: cheetah (William Fulton) Fixes for installation to work with the upcoming Automake-1.8. mkinstalldirs was being used by a non-Automake makefile. mkinstalldirs is being phased out and so was not being created by Automake. install-sh used instead. 11/16/2003: cheetah (William Fulton) [Java] Numerous director improvements, tweaks and bug fixes since the initial implementation have been contributed by Scott Michel. 11/12/2003: beazley [Python] When %feature("shadow") is used to add code to shadow classes, the special variable $action expands to the name of the underlying wrapper function that would have been called normally. 11/12/2003: beazley [Python] When generating proxy class code, SWIG emits a few default methods for __repr__() and other Python special methods. Some of these methods are emitted after all of the contents of a class. However, this makes it hard to override the methods using %pythoncode and some other directives that allow code to be inserted into a class. These special methods are now emitted into the code *before* all of the other methods. Suggested by Eric Jones. 11/11/2003: beazley Preprocessor enhancement. For include statements like this: %include "foo/bar.i" the directory "foo" is now added to the search path while processing the contents of bar.i. Thus, if bar.i includes other files in the same directory, they will be found. Previously, you would have to add additional directories using -I to make this work correctly. Note: the C preprocessor seems to behave in an identical manner on many (most? all?) systems. Suggested by Kerim Borchaev. 11/11/2003: beazley Configuration changes to make SWIG work on Mac OS X 10.3.x (Panther). Tested with Python, Tcl, Perl, and Ruby---all of which seem to work. 11/08/2003: cheetah (William Fulton) [Java] Fixed the typemaps in various.i which were mostly broken. char **STRING_IN and char **STRING_RET typemaps replaced with STRING_ARRAY. float *FLOAT_ARRAY_RETURN typemap removed. 11/08/2003: beazley [Tcl] Tcl module now emits a safe module initialization function by default. It can be removed by running 'swig -nosafe'. 11/04/2003: mkoeppe (Matthias Koeppe) [Guile] Only use the SCM_ API when the function `scm_slot_exists_p' exists (needed for GOOPS support). This function was renamed during the Guile 1.5 series from `scm_slots_exists_p'. Report the right runtime library when invoked with -scm -ldflags. 11/03/2003: mkoeppe (Matthias Koeppe) [Chicken] Fix #782052. The --with-chickencfg configure option (and others) were not accepted. 11/02/2003: mkoeppe (Matthias Koeppe) [Guile] Merge new set of GOOPS changes by John Lenz. GOOPS objects are now manipulated directly by the C code. Some fixes to typemap-GOOPS interaction. 11/02/2003: mkoeppe (Matthias Koeppe) [Guile] Remove the file argument to -scmstub and -goops. The Scheme files are now always called MODULE.scm or MODULE-primitive.scm, where MODULE is the module name and "primitive" can be changed by the -primsuffix option. The Scheme files are now placed in the directory given by the -outdir option, or the current directory. (Patch by John Lenz, slightly modified.) *** INCOMPATIBILITY [Guile] *** 11/02/2003: mkoeppe (Matthias Koeppe) Unify the pointer-conversion runtime API. The standard functions are: * SWIG_NewPointerObj (POINTER, TYPE, FLAGS) -- Create an scripting object that represents a typed pointer. FLAGS are language specific. * SWIG_ConvertPtr (INPUT, RESULT, TYPE, FLAGS) -- Get a pointer from the scripting object INPUT and store it in the place RESULT. When a type mismatch occurs, return nonzero. * SWIG_MustGetPtr (INPUT, TYPE, ARGNUM, FLAGS) -- Get a pointer from the scripting object INPUT and return it. When a type mismatch occurs, throw an exception. If ARGNUM > 0, report it as the argument number that has the type mismatch. [Guile]: No changes. [MzScheme]: No changes. [Perl]: Add the function SWIG_NewPointerObj. The function SWIG_MakePtr is kept. The function SWIG_MustGetPtr is currently not supported. [Python]: Add the function SWIG_MustGetPtr. [Ruby]: Add the function SWIG_MustGetPtr. [Tcl]: Remove the "interp" argument of SWIG_NewInstanceObj, SWIG_ConvertPtr, SWIG_ConvertPacked, and SWIG_ConvertPtrFromString. The function SWIG_MustGetPtr is currently not supported. No changes to Pike because its pointer conversion code did not look complete. No changes to PHP4, because I did not understand its runtime code. No changes to Chicken because major changes are expected soon anyway. No changes to Java, OCaml, C# because they do not seem to have a pointer-conversion runtime API. *** INCOMPATIBILITY [Tcl] *** 11/02/2003: mkoeppe (Matthias Koeppe) [Perl5, PHP4, Pike, Python, Ruby, Tcl]: Use the preprocessor to rename external functions of the SWIG runtime API to follow the naming convention SWIG__. This should allow linking more than one interpreter into a program. 10/31/2003: cheetah (William Fulton) [C#] Fix since introducing the exception and std::string delegates. The fix overcomes linker errors when using more than one SWIG module. Problem reported by Andreas Schörk. 10/31/2003: beazley Incorporated patch: [ 823302 ] Incr Tcl support. Contributed by Alexey Dyachenko. Note: needs documentation. 10/31/2003: beazley Incorporated patch: [ 829325 ] new Python Module options and features. Robin Dunn writes: This patch makes a number of changes to the SWIG python module. 1. Add -apply option, and change the default code output to use the foo(*args, **kw) calling syntax instead of using apply(). If the -apply option is given then code is generated as before. This is very similar to Patch #737281 but the new -modern option makes the second half of that patch unnecessary so it is not included here. 2. Add -new_repr option. This is the same as my Patch #797002 which I will mark as closed since it is no longer needed. When this new option is used then the __repr__ methods that are generated for proxy classes will be more informative and give details about the python class and the C++ class. 3. Add %feature("addtofunc"). It allows you to insert one or more lines of code inside the shadow method or function that is already generated, instead of replacing the whole thing like %feature("shadow") does. For __init__ it goes at the end, for __del__ it goes at the begining and for all others the code generated is expanded out to be like def Bar(*args, **kwargs): val = _module.Foo_Bar(*args, **kwargs) return val and the "addtofunc" code is inserted just before the return statement. If the feature is not used for a particular method or function then the shorter code is generated just like before. 4. A little bit of refactoring to make implementing addtofunc a little easier. 5. Added a -modern command-line flag that will cause SWIG to omit the cruft in the proxy modules that allows it to work with versions of Python prior to 2.2. The result is a simpler, cleaner and faster python proxy module, but one that requires Python 2.2 or greater. 10/31/2003: beazley Incorporated patch: [ 829319 ] XML module tweaks. This adds a new command line option -xmllite that greatly reduces the amount of emitted XML code by eliminating some fields mostly used in SWIG's internal processing. Contributed by Robin Dunn. 10/31/2003: beazley Incorporated patch: [ 829317 ] Adds DohSplitLines function. Contributed by Robin Dunn. 10/29/2003: beazley Fixed [ 827907 ] argout objects not being wrapped properly (PATH). Patch contributed by Salvador Fandiño García. 10/29/2003: beazley Fixed [ 826996 ] perl type checking ignores perl subclasses. This enhancement makes it so wrapped classes and structs can be subclassed in Perl and used normally. Patch contributed by Salvador Fandiño García. 10/16/2003: cheetah (William Fulton) [C#] IntPtr marshalled with a void* instead of int in C function declarations. The casts thus look more conventional, for example: // old DllExport double SWIGSTDCALL CSharp_get_Shape_x(int jarg1) { ... Shape *arg1 = (Shape *) 0 ; arg1 = *(Shape **)&jarg1; ... } // new DllExport double SWIGSTDCALL CSharp_get_Shape_x(void * jarg1) { ... Shape *arg1 = (Shape *) 0 ; arg1 = (Shape *)jarg1; ... } 10/14/2003: beazley Fixed a subtle problem with overloaded methods and smart pointers. If a class has overloaded methods like this: class Foo { public: int bar(int x); static int bar(int x, int y); }; and the class is used as a smart pointer: class FooPtr { public: Foo *operator->(); }; The SWIG would try to expose the static member Foo::bar through FooPtr---resulting bogus wrapper code and a compiler error. Due to the way in which overloading is handled, it is extremely difficult to eliminate the static method in this case. Therefore, it is still exposed. However, the generated code now compiles and works. 10/05/2003: mkoeppe (Matthias Koeppe) [Guile, MzScheme, Chicken]: Remove symbol clashes between the runtime libraries by renaming all extern common.swg functions with the preprocessor. 10/05/2003: mkoeppe (Matthias Koeppe) [Guile] Added basic GOOPS support, contributed by John Lenz. See the documentation for details. *** NEW FEATURE *** 10/04/2003: mkoeppe (Matthias Koeppe) [Guile] New option, -only-setters, which disables traditional getter and setter procedures for structure slots. 10/03/2003: mkoeppe (Matthias Koeppe) [Guile] Added run test for reference_global_vars by John Lenz. 09/30/2003: beazley Partial solution to [ 792180 ] C++ smart-pointer/namespace mixup revisited. The problem is not easy to fix (at least it doesn't seem so), but is related to the instantiation of qualified templates inside of other namespaces. SWIG now generates an error message in this case rather than generating broken wrappers. 09/30/2003: beazley Fixed [ 800012 ] ENTER macro from CORE/scope.h clashes with libc search.h. Reported by Britton Leo Kerin. 09/30/2003: beazley Fixed [ 811518 ] Casting ints to doubles (w/ solution?) Addresses a problem with overloading in the Perl module. Reported by Gerald Dalley. 09/28/2003: mkoeppe [Guile with -scm option] Fix typo in generated code for procedures-with-setters. Reported by John Lenz. 09/26/2003: beazley Fixed [ 812528 ] externs not correct when throw is in signature. Reported by Joseph Winston. 09/23/2003: cheetah (William Fulton) SWIG was generating a number of symbols that didn't comply with the ISO C/C++ standard, in particular ISO/IEC 14882:1998(E) 17.4.3.1.2 where double underscores are forbidden as well as symbols starting with an underscore followed by an upper case letter. Most of these have been rooted out. See new section added to internals.html development manual 'Symbol Naming Guidelines for Generated C/C++ Code'. 09/23/2003: cheetah (William Fulton) Director typemap name changes: inv => directorin outv => directorout argoutv => directorargout *** POTENTIAL INCOMPATIBILITY *** 09/19/2003: mrose (Mark Rose) [Python] Director constructors now default to __disown = 0, which is the intended behavior and fixes the director_finalizer test case under python. 09/12/2003: cheetah (William Fulton) [C#] - Typemaps added for std::string and const std::string &. - New delegate for creating a C# string given a char *. It can be used by calling SWIG_csharp_string_callback as shown in the std::string 'out' typemap. Useful if the return type is mapped to a C# string and the calling function is responsible for cleaning up memory as the C# garbage collector doesn't free the memory created in C/C++ and then returned as a C# string. - The exception delegates have moved into an inner class in the intermediate class, thereby freeing up the static constructor. 09/11/2003: beazley (Internals) Major refactoring of iteration over lists and hashes. The DOH library now uses iterators. They work like this: List *l = (some list); Iterator i; for (i = First(l); i.item; i = Next(i)) { // i.item contains the actual list item. // i.item is NULL at end of list ... } Hash *h = (some hash); Iterator j; for (j = First(h); j.item; j = Next(j)) { // j.item contains hash table item // j.key contains hash table key // Both j.item and j.key are NULL at end ... } The old iteration functions Firstitem(), Nextitem(), Firstkey(), and Nextkey() are gone. The new iterators are simpler, result in better memory use, and may be faster. Also, there are no longer any problems iterating over the same list/hash in multiple places at the same time. For example, this is fine: Iterator i,j; for (i = First(l); i.item; i = Next(i)) { for (j = First(l); j.item; j = Next(j)) { ... } } (This never worked in previous versions). *** POTENTIAL INCOMPATIBILITY ***. This will probably break third party extensions to SWIG (or give them further encouragement to join the SWIG CVS-tree :-). 09/10/2003: mkoeppe (Matthias Koeppe) [Guile] Fix memory leaks in the "list-vector.i" typemaps. 09/09/2003: mkoeppe (Matthias Koeppe) [Chicken] Use C_mk_bool rather than C_mkbool. This fixes the wrapping of boolean values for Chicken 1.10 and newer. Reported by Dave / Felix Winkelmann . 09/05/2003: cheetah (William Fulton) [Java] Directors implemented for Java. In summary this is a big new feature which supports upcalls from C++ to Java. Code is generated to support C++ callbacks to call into Java and true polymorphic behaviour for Java classes derived from C++ classes. See java.html for details. Contributed by Scott Michel. 09/05/2003: Tiger Created contract example directory at /SWIG/Examples/contract Added simple contract examples (simple_c & simple_cxx) Modified contract module's output format *** NEW FEATURE *** 09/01/2003: cheetah (William Fulton) Test-suite build improvements: - Multiple build directories working for the test suite, so it is now possible to run configure in multiple subdirectories and run the test suite in each of these sub directories. - 'make distclean' fixed so it doesn't bomb out on the Examples directory when using multiple subdiretory builds. Required the following directories to be moved: Examples/GIFPlot/Perl -> Examples/GIFPlot/Perl5 Examples/GIFPlot/Php -> Examples/GIFPlot/Php4 These new directories used to be symbolic links to the old directory. Also the Examples/test-suite/Perl symbolic link has been removed. - Running the test-suite, other than from the root directory, say in Examples/test-suite/python will now display all the code being executed. - The following 3 C# compilers are detected during configure and work with the test-suite: Mono, Portable.NET and Microsoft. 09/01/2003: Tiger Added inheritance support for design by contract feature. 09/01/2003: beazley Fixed [ 794914 ] Wrong types in template specialization. SWIG was not handling arguments correctly in template partial specialization. For example, template class Foo { public: T *blah(); }; %template(FooInt) Foo; in this class, the return type of blah was set to 'int **', but it should really be 'int *'. This has been fixed, but it will affect all prior uses of partial specialization. 09/01/2003: beazley Fixed [ 786394 ] Patch for generated perl code does not compile under RedHat9. Reported by Scott Finneran. 09/01/2003: beazley Fixed [ 791579 ] (unsigned) long long handled incorrectly (Tcl). This was an error in the Tcl typemaps.i file. Reported by Kjell Wooding. 09/01/2003: beazley Fixed [ 797573 ] no way to rename classes coming from C structures. This problem relates to renaming of anonymous structures with a typedef. For example: %rename(Bar) Foo; typedef struct { ... } Foo; Reported by Britton Leo Kerin. 09/01/2003: beazley Fixed [ 797576 ] -help seems to imply that only tcl-specific options exist. Added a comment to alert user to other options. Reported by Britton Leo Kerin. 09/01/2003: beazley Fixed [ 798205 ] Segfault in SWIG_ConvertPtr. Reported by Prabhu Ramachandran. 08/30/2003: mrose (Mark Rose) Modified the director typemaps in python/std_complex.i to use the new-style macro and conversion functions, which eliminated some redundant code. Fixed a few bugs in these typemaps as well, although more testing is needed. 08/29/2003: mrose (Mark Rose) Completed initial support for wrapping abstract classes with directors. Constructor wrappers will be generated for abstract classes that have directors, and instances of the director classes will be created regardless of whether the proxy class has been subclassed in the target language. No checks are made during construction to ensure that all pure virtual methods are implemented in the target language. Instead, calls to unimplemented methods will throw SWIG_DIRECTOR_PURE_VIRTUAL_EXCEPTION exceptions in C++. Integrated Prabhu Ramachandran's typemap patches, which provide director typemap support for enums and std::size_t, and fix a couple bugs in the director std::vector<> typemaps. 08/29/2003: cheetah (William Fulton) [C#] Implemented exception handling for throwing C# exceptions from C/C++ code. A few delegate functions are available for calling which then throw the C# exception. Use the SWIG_CSharpThrowException function from C/C++ typemaps. See the generated wrapper code or csharphead.swg for all available exceptions. Example: SWIG_CSharpThrowException(SWIG_CSharpException, "exception description"); The 'throws' typemaps are also now implemented, so code is automatically generated to convert any C++ exception into a C# System.Exception when the C++ method declares an exception specification such as: int foo() throw(Bar); Also any parameters that are references to a C++ class or a class passed by value and are passed as a C# null will now throw a C# NullReferenceException. 08/29/2003: cheetah (William Fulton) [C#] Fix to match the calling convention of all pinvoke methods so that they match the calling convention used by default in the C# 'static extern' declarations (__stdcall is used on Windows). 08/19/2003: cheetah (William Fulton) [Java] Reworked std::string typemaps. Fixes a number of string in std namespace problems. For example %template vector. The templated class' get method wasn't returning a Java String, but a SWIGTYPE_p_string. Reported by Zach Baum. 08/15/2003: beazley Fixed [ 763522 ] 1.3.19 segfault in SwigType_add_pointer/DohInsertitem. Related to problem with unnamed class handling in Perl module. 08/15/2003: beazley Fixed [ 763563 ] Missing indication of optional arguments. Tcl module. Reported by Krzysztof Kozminski. 08/15/2003: beazley Fixed [ 787432 ] long param handled as int. Tcl module now uses Tcl_GetLongFromObj to convert integer values. 08/11/2003: beazley Fixed [ 775989 ] numeric template parameters. There were some errors in template expansion related to the use of arrays where the array dimension was a template parameter. It should work now. Reported by Bryan Green. 08/10/2003: mrose (Mark Rose) Added a director typemap (outv) for return by value and cleaned up up a few of the commented director typemaps. 08/10/2003: mrose (Mark Rose) Fixed constructor generation for director classes to ignore private constructors. Protected constructors are also ignored for now, pending a solution to the problem of wrapping classes that only define protected constructors. 08/07/2003: cheetah (William Fulton) New commandline option -outdir to specify where the language specific files are to be generated. This is useful for target languages like Python, Java etc which generate proxy files in the appropriate language. This option does not apply to the C/C++ wrapper file. 08/07/2003: cheetah (William Fulton) On Windows the generated files (other than the _wrap.c or _wrap.cxx files) were sometimes incorrectly being generated into the current directory unless the input file used the Unix path separator. The Windows path separator should now be used. Bug reported by Robert Davies. 08/07/2003: beazley Added array variable set typemap to Perl module. 08/07/2003: beazley Fixed [ 775677 ] Array init causes codegen bug.. 08/07/2003: beazley Fixed [ 779062 ] Class"\n"::foo not supported. SWIG should now correctly handle whitespace in between namespace qualifiers. For example "A :: Foo :: Bar". 07/31/2003: cheetah (William Fulton) Fixes for parameters which are classes that are passed by value and have a default value. A copy constructor for SwigValueWrapper is required (SF #780056). Also fixed memory leak in these circumstances. These mods also fix SF #780054. 07/28/2003: beazley Improved run-time error message for pointers in Python module. Contributed by Zooko. 07/10/2003: ballabio (Luigi Ballabio) [Almost all languages] Wrappers for std::pair added. Typemaps for Python, Ruby, Guile and MzScheme. 07/01/2003: mkoeppe (Matthias Koeppe) [Chicken] Handle the case of more than one argout typemap per function. 06/29/2003: cheetah (William Fulton) [Java, C#] SF #670949 request. The destructor wrapper function name is now configurable. A new attribute called methodname in the javadestruct/javadestruct_derived (Java) or csdestruct/csdestruct_derived (C#) typemaps specifies the method name. For example in Java the destructor is wrapped by default with the delete method: %typemap(javadestruct, methodname="delete") SWIGTYPE {...} 06/27/2003: cheetah (William Fulton) [Java, C#] The throws attribute for adding exception classes to the throws clause also now works with the following typemaps: newfree javain, javaout (Java) csin, csout (C#) For example, the 'AnException' will be added to the throws clause in the proxy function: %typemap(javaout, throws="AnException") int { int returnValue=$jnicall; if (returnValue==0) throw new AnException("Value must not be zero"); return returnValue; } 06/25/2003: mrose (Mark Rose) [Python] Director typemap marshalling checks for null pointers when walking the parameter list instead of relying soley on the parameter count. Cures a segfault that occurred for multiple argument inv typemaps. Someone with more Swig experience should probably review this code. 06/24/2003: mkoeppe (Matthias Koeppe) [Chicken] Don't emit calls to "C_check_for_interrupt", which may result in an endless loop. Patch by felix@proxima-mt.de. 06/20/2003: cheetah (William Fulton) [C#] Finalizers now use destructor syntax as the override which was used in the Finalize method is not in the ECMA standards, spotted by the MS compiler. 06/10/2003: cheetah (William Fulton) [C#] A number of changes have been made to remove the Java naming that was used in the C# module. Typemap name changes: jni -> ctype jtype -> imtype jstype -> cstype javain -> csin javaout -> csout javainterfaces -> csinterfaces javabase -> csbase javaclassmodifiers -> csclassmodifiers javacode -> cscode javaimports -> csimports javaptrconstructormodifiers -> csptrconstructormodifiers javagetcptr -> csgetcptr javafinalize -> csfinalize Feature name changes: javaconst -> csconst javamethodmodifiers -> csmethodmodifiers Pragma changes: pragma(java) -> pragma(csharp) jniclassbase -> imclassbase jniclassclassmodifiers -> imclassclassmodifiers jniclasscode -> imclasscode jniclassimports -> imclassimports jniclassinterfaces -> imclassinterfaces Special variable name changes: $javaclassname -> $csclassname $javainput -> $csinput $jnicall -> $imcall This will break SWIG interface files that use these typemaps, features and pragmas. Please update your code or use macros for backwards compatibility. *** POTENTIAL INCOMPATIBILITY FOR C# MODULE *** 06/10/2003: mkoeppe (Matthias Koeppe) [MzScheme] Applied MzScheme module updates contributed by John Lenz . - Updated mzscheme to use SWIG's common runtime type system from common.swg. - The Lib/mzscheme directory has been reorganized to standardize names across the language modules: mzscheme.i was moved to mzscheme.swg, mzscheme.swg and mzschemedec.swg have been removed, mzrun.swg (which contains the runtime code) has been added. - The swig_proxy structure was renamed to swig_mz_proxy. swig_mz_proxy now contains a pointer to a swig_type_info structure. - Added varin and varout typemaps for SWIGTYPE [] and SWIGTYPE &. - Garbage collection by calling scheme_add_finalizer() has been added. *** NEW FEATURE [MzScheme] *** 06/10/2003: cheetah (William Fulton) [Java] New typemaps: javadestruct and javadestruct_derived for the C++ destructor wrapper. The javadestruct version gets used by classes at the top of an inheritance chain and the javadestruct_derived version gets used by other classes. [C#] cildispose and cildisposeoverride typemaps replaced by csdestruct and csdestruct_derived typemaps. The delete() method has been removed and its functionality put into these typemaps designed for the Dispose() method. - New typemaps csinterfaces and csinterfaces_derived replace the javainterfaces typemap. Also fixes the peculiarity of all classes in an inheritance chain individually deriving from the IDisposable interface. - New typemap csfinalize for finalizers. C++ destructors are now called by garbage collector during finalization. Problem reported by Andreas Schörk. 06/10/2003: Tiger Modified contract code for error message output. Contract code can now print out simple error message. Modified contract code to prepare for inheritance 06/03/2003: mkoeppe [Guile] Applied Guile module updates contributed by John Lenz . - SWIG currently uses Guile's gh_ API, which is marked as deprecated in Guile 1.6 and will be removed in Guile 1.9. This change introduces a command-line flag "-scm" which causes SWIG to generate wrappers that use Guile's SCM API instead; this requires Guile >= 1.6. - The Lib/guile directory has been reorganized to standardize names across language modules: guiledec.swg and guile.swg have been moved into guile_gh_run.swg, guile.i has been moved to guile_gh.swg, guile_scm.swg and guile_scm_run.swg which contain the SCM API stuff have been added - ghinterface.i, which contains the defines from the gh_ functions to the scm_functions has been added - The API for dealing with pointer objects is now SWIG_ConvertPtr, SWIG_MustGetPtr, SWIG_NewPointerObj. - Added varin and varout typemaps for SWIGTYPE [] and SWIGTYPE & - Garbage collection has been added. *** NEW FEATURE [Guile] *** 06/01/2003: cheetah (William Fulton) Dimensionless arrays such as int foo[] = {1, 2}; extern int bar[]; produce a warning that the variable is read-only. Depending on the target language, this used to cause compile errors or generate a setter that generated a runtime error. A setter cannot be automatically generated because the array size cannot be determined by SWIG. A varin, globalin or memberin typemap (depending on the target language) must be written by the user. 05/29/2003: beazley Refinement to default typemap matching and arrays. When an array is declared like this: int foo[4]; The default typemap now resolves to SWIGTYPE [ANY] If no match is found for that, it then resolves to SWIGTYPE [] If no array dimension is specified in the original declaration, the SWIGTYPE [] is used right away. Note: This change has been made to resolve problems related to arrays with and without dimensions. For example, sometimes SWIG was generating setter functions for array variables with no dimensions (an error). Likewise, SWIG sometimes made arrays with dimensions read-only (also an error). This fixes the arrays_global test problem. 05/28/2003: beazley Fixed subtle type handling bug with references and pointers. If you had functions like this: typedef Foo Bar; Foo *func1(); void func2(Bar &x); Then func2() wouldn't accept objects returned by func1() because of a type error. It should work now. Reported by Brian Yang. 05/21/2003: cheetah (William Fulton) Fixes to some of the Visual C++ example project files which would not work with spaces in the paths held in the environment variables used to point to the target language's library / include directory. SF bug #740769 05/21/2003: songyanf (Tiger) Added -contracts option. First try of the idea of "Wrap by Contract": build up realiable cross-language module by wrapping with SWIG. Implemented basic assertion (preassertion & postassertion & invariant) for simple C/C++ functions. Current format of contracts are: %contract class_name :: func_name (paras...) { require: boolean exprs; exprs; ensure: boolean expr; exprs; invariant: boolean expr; exprs; } *** NEW FEATURE *** 05/19/2003: cheetah (William Fulton) Build tweaks. There were a few preprocessor definitions which were specified in the Makefile for passing on the commandline when compiling. These are now all defined in swigconfig.h. Autoconf doesn't normally allow installation directories to be defined in this config header file, but an autoconf archive macro enables this. This macro along with future autoconf macros are going to be put in the Tools/config directory. 'swig -version' now reports the target build platform. 05/11/2003: cheetah (William Fulton) [C# and Java] Fix to the following typemaps: javabase, javainterfaces, javaimports, javaclassmodifiers, javaptrconstructormodifiers, javafinalize, javagetcptr & javacode. These are the typemaps for modifying/generating proxy classes. Previously the typemaps would use the proxy class name and not the C++ type, which was inconsistent with all other typemaps. In most circumstances the proxy class name and the C++ class name/type is the same except for classes in namespace, templated classes etc. so this shouldn't affect most cases. *** POTENTIAL INCOMPATIBILITY FOR JAVA and C# MODULES *** 05/09/2003: cheetah (William Fulton) Visual C++ Project files have been added so that the runtime libraries can be built on Windows (for Tcl, Perl, Python and Ruby). 05/01/2003: beazley Fixed problem with return by value, const, and private constructors. For example: class B { private: B(); public: B(const B&); }; class A { ... const B returnB() const; ... }; Problem and patch suggestion reported by Bill Hoffman. 04/29/2003: cheetah (William Fulton) Build changes: - Single autoconf invocation - autoconf in the Tools directory has gone. - Libtool bootstrapped when running autogen.sh. This requires anyone using the cvs version of SWIG to have libtool installed on their machine. Suggest version 1.4.2 or higher, preferably the latest - 1.5. - Automake is now used to build the runtime libraries in conjunction with libtool. - Runtime libraries are now successfully built as DLLs on Cygwin. - Skipping languages is no longer just determined in the top level makefile but in configure.in. This info is used for building the runtime libraries and for running the examples and test-suite. - These changes have fixed multiple build directory builds, that is building from directories other than the top level directory. Installation from multiple build directories also working. An initial configure in the top level directory is no longer needed as described in 04/02/2003 entry. A 'make distclean' will be needed before building in a directory other than the top level directory if the autotools have been run from this top level directory at some point, but autoconf will tell you this. Note that 'make check' only works from the top level directory at the moment. 04/28/2003: beazley Fixed [ 723471 ] Wrapper_print() fails with preprocessor directives. 04/28/2003: beazley Minor refinement of const static member variable handling described in CHANGES 08/11/2002. Previously, SWIG merely checked to see if there was an initializer in the declaration. Now, SWIG additionally checks to make sure the static member is const. 04/25/2003: ljohnson (Lyle Johnson) [Ruby] Added a kind of limited support for multiple inheritance, activated using the -minherit command-line option. I've also updated the "C++ Inheritance" section of the Ruby documentation to discuss how this works, and its limitations. Also also modified the minherit.i test case to run against this. 04/25/2003: ljohnson (Lyle Johnson) [Ruby] Added the -globalmodule command-line option for the Ruby module, for wrapping stuff into the global module (Kernel) instead of a nested module. Updated documentation accordingly. 04/23/2003: mrose (Mark Rose) Fixed symname error in director calls to Python methods that extend C++ operators. Stopped director destructor wrappers from calling __set_up, which was leaving the director flag in an inconsistent state. 04/23/2003: beazley Fixed problem with namespace resolution and nested namespaces. Reported by Alfred Lorber (and Marcelo Matus). 04/16/2003: cheetah (William Fulton) Patch for Java examples and test-suite to run on Mac OS X. 04/15/2003: ljohnson (Lyle Johnson) [Ruby] Incorporated Nobu Nakada's patches for supporting the Ruby 1.8 allocation framework. 04/15/2003: ljohnson (Lyle Johnson) [Ruby] Replaced all uses of the deprecated STR2CSTR() macro with the safer StringValuePtr() macro. For more information, see ruby-talk:67059 and follow-ups to that post. 04/11/2003: beazley Fixed problem with preprocessor macro expansion. For example: #define min(x,y) ((x) < (y)) ? (x) : (y) int f(int min); Reported by Sebastien Recio. 04/10/2003: cheetah (William Fulton) [Java] Added a runtime check to typemaps in arrays_java.i library to check that the Java array passed in is the same size as the C array and throw an exception if not. Also fix to use delete instead of free for arrays created using new. 04/07/2003: cheetah (William Fulton) Remove GCC3 warning when compiling the examples and test-suite: cc1plus: warning: changing search order for system directory "/usr/include" cc1plus: warning: as it has already been specified as a non-system directory See SF patch #715531 submitted by Gerald Williams 04/03/2003: cheetah (William Fulton) [C#] Improved wrapping of enums and constants. These were previously wrapped as C# variables rather than constants. Either these are wrapped as readonly (runtime) constants or compile time constants, depending on the %javaconst directive (The directive is likely to change name soon). For example wrapping: %javaconst(0); #define ABC 22 %javaconst(1) XYZ; #define XYZ 33 is now: public static readonly int ABC = examplePINVOKE.get_ABC(); public const int XYZ = 33; 04/03/2003: cheetah (William Fulton) [Java] Global constants and enums are put in their own interface called xxxConstants, where xxx is the module name. This is an improvement as it is possible to derive (implement) a Java class from the xxxConstants interface to improve the syntax; namely when wrapping: enum {ONE=1, TWO, THREE}; accessing these from a Java class implementing xxxConstants is neater: int number = ONE; than the previous: int number = xxx.ONE; Patch submitted by Dave Dribin. 04/02/2003: cheetah (William Fulton) Build improvements for multiple builds. This allows one to build the SWIG executable and runtime libraries for different platforms/compilers etc by running configure in different directories. This isn't 100% just yet and won't be until libtool is better configured... a 'configure' and 'make distclean' needs to be run in the root directory before it all works. For example: $ ./configure $ make distclean $ mkdir config1; cd config1; ../configure CC=gcc CXX=g++; make; cd .. $ mkdir config2; cd config2; ../configure CC=cc CXX=c++; make; cd .. To be improved. A 'make check' does not work yet either. 04/01/2003: beazley Fixed template partial specialization argument expansion bug. This showed up when trying to use std_vector.i with vectors of pointers. 03/31/2003: cheetah (William Fulton) Fix for parallel make builds of SWIG, for example make -j 4 Build failure reported by Bill Clarke. 03/28/2003: beazley Released 1.3.19. Version 1.3.19 (March 28, 2003) =============================== 03/28/2003: beazley Variety of minor bug fixes to the 1.3.18 release including: - Segmentation fault with %extend directive. - Typemap variable substitution bug. - Expression evaluation bug. - Large memory leak with template expansion. Version 1.3.18 (March 23, 2003) =============================== 03/21/2003: beazley Fixed two problems with the %extend directive, overloading, and template expansion. See the 'template_extend_overload' and 'template_extend_overload_2' tests in Examples/test-suite for details. 03/20/2003: cheetah (William Fulton) [C#] Added some typemaps as suggested by Andreas Schoerk for handling parameters that are passed as pointers or by reference. These have been put in typemaps.i. 03/20/2003: beazley Fixed a C++ scoping bug related to code like this: class Foo { public: int Foo::bar(); }; Previously, SWIG just tossed out the Foo::bar() declaration. Now, the declaration is wrapped provided that the prefix is exactly the same as the current scope (including any enclosing namespaces). Reported by Bruce Lowery. 03/20/2003: beazley Incorporated [ 696516 ] Enabling exception processing for data member access. In some compilers, attribute access can generate exceptions. However, SWIG ordinarily assumes that no exceptions will be raised. To disable this, use the %feature("allowexcept"). For example: %feature("allowexcept") Foo::x; ... class Foo { public: int x; /* Exception handling enabled */ ... }; Patch contributed by Yakov Markovitch. 03/20/2003: beazley Incorporated Patch. [ 701860 ] Improve Performance (python proxies). Gives a performance boost to proxy class code and the management of the .this and .thisown attributes. Contributed by Mike Romberg. 03/19/2003: cheetah (William Fulton) [C# and Java] Added missing vararg support. 03/18/2003: mrose (Mark Rose) Removed code related to tagging individual methods for directors. The concept of having directors for some but not all virtual methods of a class is deeply flawed. The %feature("nodirector") tag is also gone. Directors are off by default. To enable them for a class, issue %feature("director") classname; which will create director methods for every virtual method in the hierarchy of the class. 03/17/2003: beazley Fixed a subtle problem with passing arguments of type function. For example: int foo(int x(int, int)); or typedef int binop_t(int, int); int foo(binop_t x); In old versions, this would produce code that wouldn't compile. Now, SWIG merely adds an extra pointer, making these declarations the same as: int foo(int (*x)(int, int)); typedef int binop_t(int, int); int foo(binop_t *x); Reported by Garth Bushell. 03/17/2003: mrose (Mark Rose) Fixed the return statement for director base class calls that have no return value. 03/15/2003: beazley Fixed a problem with const smart-pointer wrapping. For example: class Foo { public: int x; void bar() const; void spam(); }; class Blah { ... const Foo *operator->(); ... }; In this case, only "x" and "bar" are visible from Blah (since application of spam violates constness). Moreover, access to "x" is read-only. 03/15/2003: mrose (Mark Rose) Cleaned up two signed versus unsigned comparisons in python/std_vector.i. 03/15/2003: cheetah (William Fulton) [C#] Global variables are wrapped using properties instead of get and set methods. Member variable wrapping bug fixes, for example wrapping pointers work now. Typemaps are used for all variable wrapping to generate the property code. 03/13/2003: mrose (Mark Rose) Fixed a bug in the virtual method unrolling for directors. The order of unrolling is now from base to derived, to ensure that the most derived implementation of a director method is found. Director methods for pure virtual methods now throw DIRECTOR_PURE_VIRTUAL_EXCEPTION if _up is set. 03/12/2003: cheetah (William Fulton) [C#] Polymorphism fix: virtual functions now use the appropriate keyword in the C# proxy class, virtual or override. Some 'using System;' statement fixes needed by the Mono compiler. 03/11/2003: beazley Fixed subtle bug in the application of SwigValueWrapper<> to template classes with default constructors. Reported by Bruce Lowery. 03/11/2003: beazley The $descriptor(type) variable is now expanded in code supplied to %extend. This is useful for certain kinds of advanced wrapping (especially container classes). 03/11/2003: luigi Support for std::map. (a) Integration with scripting language (a la std::vector) for Python, Ruby, MzScheme, and Guile; (b) Simple wrapper for other languages 03/10/2003: beazley Fixed problem with escape sequences in string and character constants. SWIG wasn't parsing certain octal codes correctly. 03/07/2003: beazley Fixed a variety of subtle preprocessor problems reported by Sebastien Recio. (a) Empty preprocessor values no longer generate "bad constant value" errors. For example: #define FOO #define FOO BAR (b) Macro names can now span multiple lines (technically valid, although questionable practice). For example: #define A_LONG_MACRO_\ NAME 42 (c) Whitespace is no longer required before certain macro values. For example: #define FOO"Hello" #define BAR\ "Hello" 03/07/2003: ljohnson (Lyle Johnson) [Ruby] Added missing long long and unsigned long long typemaps in the Lib/ruby/typemaps.i library file. 03/07/2003: mrose (Mark Rose) Added Examples/python/callback to demostrate how directors can be used to implement callbacks in Python Added Examples/python/extend to demonstrate virtual method calls from C++ to Python (really the same as the callback example, just a different context). Added four tests for very basic director functionality. These have runtime tests under python. The Python module now emits #define SWIG_DIRECTORS near the top of the output file if directors are enabled. This is useful for disabling parts of tests in target languages that don't support directors. 03/06/2003: mrose (Mark Rose) Added a section to Doc/Manual/Python.html on cross language polymorphism (directors). 03/06/2003: mrose (Mark Rose) The short-lived "-fdirectors" command line option has been removed. To enable directors, instead use the extended %module directive as follows: %module(directors="1") modulename 03/06/2003: cheetah (William Fulton) The long long typemaps have been rewritten so that they can be more easily used with non ISO compilers, like Visual C++. For example if you are wrapping the Windows 64 bit type __int64 the long long typemaps can be used with %apply: %apply long long { __int64 }; __int64 value1(__int64 x); __int64 will now appear in the generated code instead of long long. 03/06/2003: beazley *** DEVELOPER CHANGE *** Swig module mutation has been changed slightly. When a language class method wants to save node attributes, it now uses one of the following functions: Swig_require() Swig_save() The first argument to these functions is a namespace in which saved attributes are placed. For example,this code Node *n; Swig_save("cDeclaration",n,"type","parms","name",NIL); saves the attributes as "cDeclaration:type", "cDeclaration:parms", and so forth. If necessary, a language module can refer to old values by using this special namespace qualifier. In addition to this, a special attribute "view" contains the name of the last namespace used to save attributes. In the above example, "view" would have the value "cDeclaration". The value of "cDeclaration:view" would have the previous view and so forth. Swig_restore(n) restores a node to the state before the last Swig_require() or Swig_save() call. Note: This change makes it easier for language modules to refer to old values of attributes. 03/06/2003: mrose (Mark Rose) Merged the cross-language polymorphism patch. When enabled, C++ "proxy" classes (called directors) are generated for each specified C++ class. Directors pass method calls from C++ to Python, similar to the way the usual proxy (shadow) classes pass method calls from Python to C++. Together, these two types of proxies allow C++ classes that are extended in Python to behave just like ordinary C++ classes and be used in C++ like native objects. This feature is still very experimental and is disabled by default. To enable director support, specify '-fdirectors' on the SWIG command line or in the SWIG_FEATURES environment variable. In the interface file, add %feature("director") to generate directors for all classes that have virtual methods. See http://stm.lbl.gov/~tm2/swig/ProxyDoc.html for more details. 03/03/2003: beazley Fixed a small glitch in typemap local variable replacement. If you had a typemap like this: %typemap(in) type ($1_type temp) { ... temp = ...; ... } and no occurrence of "$1_type" appeared in the body, then the local variable type wouldn't be substituted. 03/03/2003: cheetah (William Fulton) [C#] New version of the CSharp module which is typemap based. It also uses ECMA C# and no longer uses Microsoft Visual C++.NET glue. This means that it will work on non-Windows platforms. Contributed by Neil Cawse. 02/27/2003: beazley Fixed [ 653548 ] error parsing casting operator definition. SWIG now ignores casting operators declared outside of a class. For example: inline A::operator char *() { ... } Bug reported by Martin Casado. 02/27/2003: beazley Added support for anonymous bit-fields. For example: struct Foo { int x : 4; int : 4; int y : 8; }; Anonymous bit-fields are ignored by SWIG. Problem reported by Franz Höpfinger. 02/26/2003: cheetah (William Fulton) [Java] Better typemaps in the Examples/java/typemap example and also fixes subtle bug when using the StringBuffer typemaps more than once. 02/26/2003: beazley Fixed [ 642112 ] Constants char bug. 02/26/2003: beazley Fixed [ 675337 ] Partial template specialization not entirely working. There was a subtle problem related to the naming and ordering of template partial specialization arguments. Matching worked okay, the resulting templates weren't expanded correctly. 02/25/2003: beazley Fixed problem with parsing (and generating code) for references to arrays. For example: int foo(int (&x)[10]); 02/25/2003: beazley Fixed [ 635347 ] Compilation warning from libpy.c. Reported by Daniel L. Rall. 02/25/2003: beazley Fixed a subtle problem with virtual method implementation checking and typedef. typedef int *intptr; struct A { virtual int *foo() = 0; }; struct B : public A { virtual intptr foo() { }; }; SWIG was treating these declarations as different even though they are the same (via typedef). 02/25/2003: ljohnson (Lyle Johnson) [Ruby] Added range checking for the NUM2USHRT macro, per [ 675353 ]. 02/24/2003: beazley Fixed a subtle problem with the code that determined if a class is abstract and can be instantiated. If you had classes like this: struct A { virtual int foo(int) = 0; }; struct B : virtual A { virtual int foo(int); }; struct C : virtual A { }; /* Note order of base classes */ struct D : B, C { }; /* Ok */ struct E : C, B { }; /* Broken */ then SWIG determined that it could instantiate D(), but not E(). This inconsistency arose from the depth-first search of the inheritance hierarchy to locate the implementations of virtual methods. This problem should now be fixed---SWIG will attempt to locate any valid implementation of a virtual method by traversing over the entire hierarchy. 02/22/2003: cheetah (William Fulton) [Java] Fix for using enum typemaps. The Java final static variable type can be set using the jstype typemap, enabling enums to be mapped to something other than int. Bug reported by Heiner Petith. 02/21/2003: songyanf (Tiger) Added CSharp (C#) module prototype i.e. csharp.cxx & csharp.h at Source/Modules/. They are for test usage only now and need improvement. The interface also need to be modified. *** NEW FEATURE *** 02/20/2003: songyanf (Tiger) Fixed problem with typedef with -fvirtual. Similar as beazley's modification today. 02/20/2003: beazley Added support for gcc-style variadic preprocessor macros. Patch [ 623258 ] GCC-style vararg macro support. Contributed by Joe Mason. 02/20/2003: beazley Fixed [ 605162 ] Typemap local variables. Reported by Lyle Johnson. 02/20/2003: beazley Fixed problem with abstract classes and typedef. For example: class Foo { public: virtual void foo(int x) = 0; }; typedef int Integer; class Bar : public Foo { public: virtual void foo(Integer x); }; SWIG was getting confused about the latter method---making Bar abstract. Reported by Marcelo Matus. 02/19/2003: cheetah (William Fulton) [Java] %javaconst(flag) can also be used on enums as well as constants. This feature enables true Java compiler constants so that they can be used in Java switch statements. Thanks to Heiner Petith for patches. 02/19/2003: songyanf (Tiger) Modified -fcompact feature to deal with PP lines 02/18/2003: beazley Fixed [ 689040 ] Missing return value in std_vector.i. Reported by Robert H. de Vries. 02/18/2003: beazley Fixed a few evil scoping problems with templates, namespaces, and the %extend directive. Problem reported by Luigi Ballabio. 02/18/2003: cheetah (William Fulton) [Ruby] Improved support for Visual C++ and other native Windows compilers. It is no longer necessary to specify "/EXPORT:Init_", where is the swig module name when linking using these native Windows compilers. 02/15/2003: songyanf (Tiger) Added -fvirtual option. Reduce the lines and size of the wrapper file by omitting redifined virtual function in children classes. Modified -compact option to -fcompact option Added -small option. -small = -fvirtual -fcompact And it can be extended by future feature options, which are used to reduce wrapper file szie. Added SWIG_FEATURES environment variable check. To dynamically set the feature options such as -fcompact & -fvirtual *** NEW FEATURE *** 02/13/2003: lenz Updated Doc/Manual/Perl5.html to talk about C++ compile problems configure.in now checks for PERL5_CCFLAGS Runtime/Makefile.in and Example/Makefile.in now use PERL5_CCFLAGS Added Lib/perl5/noembed.h which contains all the known macro conflicts 02/12/2003: beazley Fixed [ 685410 ] C++ Explicit template instantiation causes SWIG to exit. Fixes a syntax error with declarations similar to this: template class std::vector; SWIG now ignores the instantiation and generates a warning message. We might do more later. Reported by Thomas Williamson. 02/11/2003: cheetah (William Fulton) Rewrote bool typemaps to remove performance warning for compiling generated code under Visual C++. 02/11/2003: cheetah (William Fulton) Fix for wrapping reference variables (const non-primitive and all non-const types) for example: int& i; Class& c; const Class& c; 02/11/2003: beazley Fixed more very subtle preprocessor corner cases related to recursive macro expansion. For example: #define cat(x,y) x ## y cat(cat(1,2),3) // Produces: cat(1,2)3 #define xcat(x,y) cat(x,y) xcat(xcat(1,2),3) // Produces 123 See K&R, 2nd Ed. p. 231. 02/10/2003: cheetah (William Fulton) Fixed [ 683882 ] - patch submitted by F. Postma for SWIG to compile on HP-UX. 02/10/2003: beazley Fixed subtle preprocessor argument expansion bug. Reported by Marcelo Matus. 02/10/2003: songyanf Added -compact option. Reduce the lines and size of the wrapper file by omitting comments and combining short lines. *** NEW FEATURE *** 02/07/2003: beazley Fixed [ 651355 ] Syntax error with cstring.i Reported by Omri Barel. 02/07/2003: beazley Fixed [ 663632 ] incompatibility with standard cpp. This is a refinement that fixes this problem: // Some macro with an argument #define FOO(x) x int FOO; /* Not a macro---no arguments */ 02/05/2003: beazley Fixed [ 675491 ] parse error with global namespace qualification. Submitted by Jeremy Yallop. 02/04/2003: beazley Fixed bug in varargs processing introduced by the numinputs typemap parameter. 01/08/2003: ttn [xml] Fix string-replacement ordering buglet. Thanks to Gary Herron. 12/23/2002: cheetah (William Fulton) Further build changes: - The SWIG executable is now built using a single Makefile. - This makefile is generated by Automake (Source/Makefile.am). - Dependency tracking and tags support are in this makefile. - Automake 1.7.2 and Autoconf 2.54 minimum versions are needed to build SWIG from CVS. - Running ./autogen.sh now installs Autoconf/Automake support files into Tools/config and these files are no longer stored in CVS. - Bug fixes in 'make install' for systems using .exe executable extension and ./configure --with-release-suffix=whatever 12/16/2002: cheetah (William Fulton) More build changes: - Autoconf's AC_CANONICAL_HOST replaces proprietary approach for detecting build host. - Autoconf support files moved to Tools/config. 12/16/2002: cheetah (William Fulton) Modifications to run on MacOS, submitted by Bernard Desgraupes. Mainly ensuring generated files are output in the appropriate directory for some modules. 12/11/2002: cheetah (William Fulton) Various build modifications and bug fixes: - Simplification of version string. Use autoconf's PACKAGE_VERSION instead. - Build time removed from SWIG version. - Using standard autoconf config header generation. - Updated old autoconf macros as reported by autoupdate. - Removed $prefix in autoconf from search paths as autoconf won't expand them. - Subtle bug fix where 'make prefix=/somewhere; make clean; make prefix=/somwhere/else' produced an executable using the incorrect library directories. - Added -ldflags commandline option for MzScheme, Ocaml, Pike and PHP. - Fixed reporting of compiler used when using -version commandline option. - SWIG web address added to -version commandline option. 12/11/2002: beazley Minor fix to Tcl dynamic cast typemaps. Reported by Kristopher Blom. 12/10/2002: beazley Fixed subtle template argument replace bug. Reported by Chris Flatley. 12/10/2002: beazley Reverted CHANGES 09/03/2002, preprocessor argument evaluation. Arguments are not evaluated during collection, K&R, p. 230. 12/06/2002: beazley Fixed [ 649022 ] Compilation problems with KAI/KCC 12/02/2002: beazley SWIG 'rel-1-3' CVS branch merged back into the main branch. Version 1.3.17 (November 22, 2002) ================================== 11/19/2002: beazley Fixed [ 613922 ] preprocessor errors with HAVE_LONG_LONG. 11/19/2002: beazley Fixed [ 615480 ] mzscheme SWIG_MustGetPtr_. 11/19/2002: beazley Fixed [ 635119 ] SWIG_croak causes compiler warning. 11/16/2002: cheetah (William Fulton) [Java] Added typemaps for pointers to class members. 11/15/2002: cheetah (William Fulton) [Java] Bug fix: Overloaded C++ functions which cannot be overloaded in Java once again issue a warning. 11/14/2002: cheetah (William Fulton) [Java] Handling of NULL pointers is improved. A java null object will now be translated to and from a NULL C/C++ pointer by default. Previously when wrapping: class SomeClass {...}; void foo(SomeClass *s); and it was called from Java with null: modulename.foo(null) a Java NullPointerException was thrown. Extra typemaps had to be written in order to obtain a NULL pointer to pass to functions like this one. Now the default wrapping will detect 'null' and translate it into a NULL pointer. Also if a function returns a NULL pointer, eg: SomeClass *bar() { return NULL; } Then this used to be wrapped with a SomeClass proxy class holding a NULL pointer. Now null is returned instead. These changes are subtle but useful. The original behaviour can be obtained by using the original typemaps: %typemap(javaout) SWIGTYPE { return new $&javaclassname($jnicall, true); } %typemap(javaout) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] { return new $javaclassname($jnicall, $owner); } %typemap(javagetcptr) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] %{ protected static long getCPtr($javaclassname obj) { return obj.swigCPtr; } %} *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE *** 11/12/2002: beazley Fixed problem with abstract methods and signatures. For example: class abstract_foo { public: virtual int meth(int meth_param) = 0; }; class abstract_bar : public abstract_foo { public: int meth(int meth_param_1, int meth_param_2) { return 0; } }; In this case, abstract_bar is still abstract. Fixes [ 628438 ] Derived abstract class not abstract. Reported and patched by Scott Michel. 11/11/2002: beazley Fixed a matching problem with typemaps and array dimensions. For example, if you had this: typedef char blah[20]; and a typemap: %typemap() char [ANY] { ... $1_dim0 ... } then $1_dim* variables weren't be expanded properly. It should work now. Problem reported by Pankaj Kumar Goel. 11/07/2002: mkoeppe Added an experimental new module that dumps SWIG's parse tree as (Common) Lisp s-expressions. The module is invoked with SWIG's -sexp command-line switch. The output can be read into Common Lisp. There is (prototype) example Lisp code that generates Foreign Function Interface definitions for use with Kevin Rosenberg's UFFI. *** EXPERIMENTAL NEW FEATURE *** 11/07/2002: mkoeppe Removed duplicate declaration of "cpp_template_decl" in parser.y; bison 1.75 complained. 11/06/2002: cheetah (William Fulton) [Java] Default primitive array handling has changed like arrays of classes. C primitive arrays are no longer wrapped by a Java array but with a pointer (type wrapper class). Again the changes have been made for efficiency reasons. The original typemaps have been moved into arrays_java.i, so the original behaviour can be obtained merely including this file: %include "arrays_java.i" The array support functions are no longer generated by default. They are only generated when including this file, thus this often unused code is only generated when specifically requiring this type of array support. *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE *** 11/05/2002: ljohnson (Lyle Johnson) [Ruby] Added support for nested module declarations (as was previously added for the Perl module). So a %module directive of the form: %module "Outer::Inner::Foo" will nest everything as (in Ruby code): module Outer module Inner module Foo # stuff goes here end end end 11/05/2002: mkoeppe [MzScheme] Add an argument (-declaremodule) that generates code to correctly declare a primitive module extension. Patch submitted by Bruce Butterfield. 11/02/2002: cheetah (William Fulton) [Java] Added patch submitted by Michael Cahill to remove unused parameter warnings for the jenv and cls parameters. This patch also also allows one to use "void" in the jni typemap for any type without code being generated attempting to return a value. 10/29/2002: cheetah (William Fulton) [Java] Array handling is different. Arrays of classes are no longer wrapped with proxy arrays, eg wrapping class X {...}; X foo[10]; used to be wrapped with these Java getters and setters: public static void setFoo(X[] value) {...} public static X[] getFoo() {...} This approach is very inefficient as the entire array is copied numerous times on each invocation of the getter or setter. These arrays are now wrapped with a pointer so it is only possible to access the first array element using a proxy class: public static void setFoo(X value) {...} public static X getFoo() {...} Arrays of enums have also been similarly changed. This behaviour is now like the other SWIG language's implementation and the array library should be used to access the other elements. The original behaviour can be achieved using the macros and typemaps in arrays_java.i, for example: %include "arrays_java.i" JAVA_ARRAYSOFCLASSES(X) class X {...}; X foo[10]; *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE *** 10/29/2002: cheetah (William Fulton) [Java] Two new typemaps javain and javaout for generating the proxy class and type wrapper class method calls to the JNI class. The new typemaps are really used for transforming the jstype (used in proxy class and type wrapper classes) to the jtype (used in the JNI class) and visa versa. A javain typemap is required whenever an in typemap is written and similarly javaout for an out typemap. An example is probably best to show them working: %typemap(javain) Class "Class.getCPtr($javainput)" %typemap(javain) unsigned short "$javainput" %typemap(javaout) Class * { return new Class($jnicall, $owner); } %inline %{ class Class {}; Class * bar(Class cls, unsigned short ush) { return new Class(); }; %} The generated proxy code is then: public static Class bar(Class cls, int ush) { return new Class(exampleJNI.bar(Class.getCPtr(cls), ush), false); } Some new special variables have been introduced in order to use these typemaps. Here $javainput has been replaced by 'cls' and 'ush'. $jnicall has been replaced by the native method call, 'exampleJNI.bar(...)' and $owner has been replaced by 'false'. $javainput is analogous to the $input special variable. It is replaced by the parameter name. $jnicall is analogous to $action in %exception. It is replaced by the call to the native method in the JNI class. $owner is replaced by either true if %newobject has been used otherwise false. The java.swg file contains default javain and javout typemaps which will produce the same code as previously. This change is only of concern to those who have written their own typemaps as you will then most likely have to write your own javain and javaout typemaps. The javaout typemap also makes it possible to use a Java downcast to be used on abstract proxy base classes. See the Java documentation on dynamic_cast. *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE *** 10/24/2002: ttn [Methodology] Upgaded to libtool 1.4.3, presumably w/ better support for newish platforms (like MacOS X). 10/21/2002: ttn Fixed Runtime/Makefile.in bug -- thanks to Richard Calmbach. 10/18/2002: ttn Fixed typo in doh.h -- thanks to Max Horn. Version 1.3.16 (October 14, 2002) ================================= 10/13/2002: beazley Fixed bug with %extend directive and %feature reported by William Fulton. 10/13/2002: beazley Added OpenVMS build directory (vms). Contributed by Jean-François Pieronne. 10/09/2002: cheetah (William Fulton) [Java] Added throws clause to the native functions in the JNI class. The throws clause is the same as the one generated for proxy functions and module class functions. 09/27/2002: beazley Fixed some problems with the %import directive and classes that were defined but not wrapped. Problem reported by Leslie Brooks, Gerry Woods, and others. 09/23/2002: cheetah (William Fulton) [Java] Some error checking added: 1) OutOfMemoryException check in the char * typemaps. 2) As SWIG treats pointers, references and passing by value all the same, it is possible to pass a NULL pointer to a function that expects an object passed by value or by reference. A NullPointerException is now thrown under this scenario. 09/20/2002: ttn [Methodology] Reworked "make clean" and "make install" to be more table driven. [Docs] Explain how to extend "make install" w/ extra-install.list. 09/15/2002: beazley Deprecation of the "ignore" typemap. The "ignore" typemap has been deprecated in favor of a generalization of the "in" typemap. To ignore an argument, use something like this instead: %typemap(in,numinputs=0) int *output (int temp) { $1 = &temp; } This change fixes a number of subtle bugs related to the interaction of the "in" and "ignore" typemaps (which were supposed to be mutually exclusive). The use of the numinputs argument is reserved for future expansion. Currently, values >1 will generate an error. However, future releases of SWIG may utilize that to support multi-input typemaps. %typemap(ignore) still works, but generates a warning message and is translated to %typemap(in,numinputs=0). *** POTENTIAL INCOMPATIBILITY *** *** NEW FEATURE *** 09/15/2002: beazley Fixed segmentation fault for unnamed structures. For example: typedef struct { } *blah; Reported by Roger Gibson. Note: we might be able to generate wrappers in special cases. 09/13/2002: beazley Minor modification to generated wrapper functions. Pointer arguments are now always set to an initial value of 0. Simplifies typemap writing and cleanup code (since you can rely on zero-value initialization). This also greatly reduces the need to ever write an "arginit" typemap. 09/12/2002: beazley Minor enhancement to smart-pointer support. If operator->() is part of an ignored base class like this, %ignore Bar; class Foo { public: int blah(); }; class Bar { /* Ignored */ public: ... Foo *operator->(); ... }; class Spam : public Bar { }; then methods from Foo are still available. For example, >>> s = Spam() >>> s.blah() 0 >>> The only catch is that the operator->() itself is not available (since it wasn't wrapped). Therefore, there won't be any __deref__() operation unless it is explicitly added to Spam (either using %extend or just placing operator->() in the definition of Spam). 09/11/2002: ttn [Methodology] Reworked "make check" to be more table driven. [Docs] Docuemented methodology in Manual/Extending.html. 09/11/2002: ttn [Docs] Prefixed Manual/*.html with "" to pander dotingly to (over-)sensitive editors. 09/10/2002: ttn [Guile] Converted Examples/guile/simple "make check" behavior to actually check execution results. Reduced iteration counts so that the test doesn't take too long. 09/10/2002: beazley SWIG-1.3.15 released. Version 1.3.15 (September 9, 2002) ================================== 09/09/2002: beazley Fixed nasty runtime type checking bug with subtypes and inheritance and templates. 09/09/2002: cheetah (William Fulton) [Java] Java exception classes for a method's throws clause can be generated by specifying them in a comma separated list in the throws attribute in any one of the following typemaps: in, out, check, freearg, argout and throws. A classic example would be to convert C++ exceptions into a standard Java exception: %typemap(throws, throws="java.io.IOException") file_exception { jclass excep = jenv->FindClass("java/io/IOException"); if (excep) jenv->ThrowNew(excep, $1.what()); return $null; // or use SWIG_fail } class file_exception {...}; void open(const char *filename) throw(file_exception); The Java method will then be declared with a throws clause: public static void open(String filename) throws java.io.IOException {...} 09/08/2002: mkoeppe * [Guile] Improved the documentation system. The arglist no longer gets cluttered with type specification, making it more readable. (Also the ILISP function C-u M-x `arglist-lisp' RET works better this way.) The types of arguments are explained in an extra sentence after the arglist. There are now two documentation-related typemap arguments: %typemap(in, doc="$NAME is a vector of integers", arglist="$name") int *VECTOR { ... } The "arglist" texts of all arguments of a function make up its arglist in the documentation. The "doc" texts of all arguments are collected to make a sentence that describes the types of the arguments. Reasonable defaults are provided. As usual, $name is substituted by the name of the argument. The new typemap variable $NAME is like $name, but marked-up as a variable. This means that it is upper-cased; in TeXinfo mode ("-procdocformat texinfo") it comes out as @var{name}. The directives %values_as_list, %values_as_vector, %multiple_values now also have an effect on the documentation. (This is achieved via the new pragmas return_nothing_doc, return_one_doc, return_multi_doc.) Documentation has also improved for variables that are wrapped as procedures-with-setters (command-line switch "-emit-setters"). * [Guile] Emit constants as _immutable_ variables. (This was broken recently.) 09/07/2002: mkoeppe [Guile] Updated the typemaps in list-vector.i. 09/07/2002: mkoeppe Short-circuit the typechecks for overloaded functions. (The changes in code generation are visible in the new testcase "overload_complicated".) 09/06/2002: cheetah (William Fulton) [Java] Solution for [ 596413 ] New typemap so that the Java proxy classes and type wrapper classes wrapper constructor modifier can be tailored by users. The default value is protected. Normally SWIG generates a constructor like this which can only be accessed within one package: protected Bar(long cPtr, boolean cMemoryOwn) { ... } If you are using SWIG across multiple packages or want to use this constructor anyway, it can now be accessed outside the package. To modify use for example: %typemap(javaptrconstructormodifiers) SWIGTYPE "public" to change to public for all proxy classes and similarly for all type wrapper classes: %typemap(javaptrconstructormodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] "public" 09/06/2002: cheetah (William Fulton) [Java] Added throws typemaps for the Java module. C++ exceptions get converted into java.lang.RuntimeException Java exceptions. Warning: This may change from java.lang.Runtime exception in the future. 09/05/2002: cheetah (William Fulton) [Java] Fix for variables declared as references. 09/05/2002: beazley Fixed [ 605162 ] Typemap local variables. Reported by Lyle Johnson. 09/05/2002: ljohnson (Lyle Johnson) [Ruby] More updates to the Ruby module documentation, including a new typemap example that demonstrates how to collect key-value pairs from an argument list into a Hash. 09/05/2002: beazley Fixed bug with template expansion and constructors. template class Foo { public: Foo() { } }; The extra in the constructor was carried through in the name--causing runtime problems in generated modules. Reported by Jordi Arnabat Benedicto. 09/05/2002: mkoeppe [Guile] Support overloading. 09/04/2002: ljohnson (Lyle Johnson) [Ruby] Updated typemaps for long long and unsigned long long types to use Ruby 1.7 support for these types when available. 09/04/2002: ljohnson (Lyle Johnson) [Ruby] Added output typemaps for const reference to primitive types. 09/04/2002: mkoeppe [Guile] Fix pass-by-value typemaps. Reported by Arno Peters via Debian bugtracking (#156902), patch by Torsten Landschoff . 09/03/2002: samjam (Sam Liddicott) Better reference support. Functions that want a void** can take a NULL by reference and the void* will be made for you and then passed-by-reference Also all integer-class native types can be passed by reference where an int* or int& etc is needed 09/03/2002: beazley Changed the evaluation order of preprocessor macro arguments. Arguments are now expanded by the preprocessor *before* they are passed to macro expansion. This fixes a subtle expansion bug reported by Anthony Heading. 09/03/2002: beazley Fixed the file include order (again, apparently). See 2/27/99. 09/02/2002: beazley [Perl] Better exception handling support. Since Perl error handling relies on setjmp/longjmp, wrapper functions have been modified slightly to provide an extra block scope: XS(foo) { char _swigmsg[SWIG_MAX_ERRMSG] = ""; const char *_swigerr = _swigmsg; { /* Normal wrapper function here */ ... SWIG_croak("An error occurred\n"); ... XSRETURN(argvi); /* Successful return */ fail: /* cleanup code */ } croak(_swig_err); } The macro SWIG_croak(x) sets the value of _swigerr to x and executes a "goto fail". The whole wrapper function is enclosed block scope to provide proper cleanup of C++ objects. Since croak executes a longjmp(), there is no way to properly reclaim resources if this executes in the same scope as the wrapper function. The _swigmsg[] variable is normally unused, but can be used to store small error messages using sprintf or snprintf. It has a capacity of at least 256 bytes (SWIG_MAX_ERRMSG). 09/02/2002: beazley [Tcl] Added better support for exceptions. Instead of returning TCL_ERROR, use the macro SWIG_fail to return with an error. This ensures that arguments are properly cleaned up. Exception specifiers are now handled by default. 09/02/2002: ljohnson (Lyle Johnson) [Ruby] The type-checking system for the Ruby module has had a flaw in that some types which should be considered equivalent weren't. This bug was best demonstrated by the inherit_missing.i test suite case, which defines a base class "Foo" that is subclassed by "Bar". The "Foo" class isn't actually wrapped (i.e. it's not directly accessible from Ruby) but we'd still like to be able to pass "Bar" instances to functions expecting Foos and have that work; it wasn't. The revised implementation (similar to that used for some other language modules) adds a new instance variable (__swigtype__) to each object that indicates its SWIG type; that is, each "Bar" instance will now have a string instance variable called "__swigtype__" whose value is "_p_Bar". Unless developers were taking advantage of this low-level implementation detail, they shouldn't notice any compatibility problems; nevertheless, I'm marking it as a "potential incompatibility". *** POTENTIAL INCOMPATIBILITY *** 09/01/2002: ljohnson (Lyle Johnson) [Ruby] Fixed SF Bug #603199. 08/08/2002: cheetah (William Fulton) [Java] Added OUTPUT, INPUT and INOUT typemaps in typemaps.i for C++ references. 08/27/2002: mkoeppe [Guile] Fixed error in "lib_std_vector" testcase and compiler warning in "lib_cdata" testcase. 08/27/2002: ljohnson (Lyle Johnson) [Ruby] Added the "%mixin" directive, which allows the user to specify a comma-separated list of module names to mix-in to a class. So, for example, if you'd like to specify that Ruby's Enumerable module should be mixed-in to your class Foo, you'd write: %mixin Foo "Enumerable"; or to specify that the modules Fee, Fie and Fo should be mixed in to Foo: %mixin Foo "Fee,Fie,Fo"; *** NEW FEATURE *** 08/27/2002: ljohnson (Lyle Johnson) [Ruby] Modified the %alias directive so that multiple aliases can be specified for an instance method by using a comma-separated list of aliases. 08/27/2002: ljohnson (Lyle Johnson) [Ruby] Added "throw" typemaps for the Ruby module. 08/26/2002: beazley Two new command line options for printing dependencies. 'swig -M' lists all file dependencies. 'swig -MM' lists dependencies, but excludes files in the SWIG library. Example: % swig -M -python example.i example_wrap.cxx: \ /u0/beazley/Projects/lib/swig1.3/swig.swg \ /u0/beazley/Projects/lib/swig1.3/python/python.swg \ example.i \ example.h % swig -MM -python example.i example_wrap.cxx: \ example.i \ example.h *** NEW FEATURE *** 08/26/2002: beazley Fixed [ 597599 ] union in class: incorrect scope. Reported by Art Yerkes. 08/26/2002: beazley Fixed [ 600132 ] Default argument with namespace. Reported by Shibukawa Yoshiki. 08/24/2002: beazley Automatic C++ exception handling enabled for all language modules. This is pretty simple. If you have a class like this: class Foo { }; class Bar { public: void blah() throw(Foo); } then the generated wrapper code looks like this: wrap_Bar_blah() { ... try { arg1->blah(); } catch (Foo &_e) { /* "throw" typemap code inserted. $1 = _e */ } catch (...) { throw; } } The "throw" typemap can be used to raise an error in the target language. It can do anything. Here is a very simple example: %typemap("throw") Foo { PyErr_SetString(PyExc_RuntimeError, "Foo exception"); return NULL; } To make this work in each language module, simply define a few default "throw" typemaps for SWIGTYPE, SWIGTYPE *, int, const char *, and a few common exception types. That's all there is to it. Automatic exception handling can be disabled using -noexcept or setting the NoExcept global variable to 1. *** NEW FEATURE *** 08/23/2002: beazley [ Python ] Automatic translation of C++ exception specifications into error handling code. For example: class Foo { }; class Bar { public: void blah() throw(Foo); } In this case, Foo is wrapped as a classic-style class (compatible with exception handling). Furthermore, you can write Python code like this: b = Bar() try: b.blah(); except Foo,e: # Note use of exception class here! # Handle Foo error ... The object "e" in the exception handler is just a wrapped Foo object. Access it like a normal object. If an exception is not wrapped as a class, a RuntimeError exception is raised. The argument to this exception is the exception object. For example: class Bar { public: void blah() throw(int); } b = Bar() try: b.blah(); except RuntimeError,e: print e.args[0] # Integer exception value Comments: - If a class is used as an exception, it *must* be wrapped as a Python classic-style class (new classes don't work). - Automatic exception handling is compatible with %exception. - Use -noexcept to turn off this feature. - The newly introduced "throw" typemap is used to raise Python errors (naturally). *** EXPERIMENTAL NEW FEATURE *** 08/23/2002: beazley Information from throw() specifiers is now stored in the parse tree. For example: class Foo { public: int blah() throw(spam,bar); } The stored information is fully corrected for namespaces and works with templates. Uses will follow. 08/22/2002: beazley Exception handling code is no longer applied to member access function. For example, in this code %exception { try { $action } catch(whatever) { ... } } class Foo { public: int x; ... } The exception handling code is not applied to accessor functions for Foo::x. This should reduce the amount of extra code generated. Caveat: Exception handling code *is* used when attributes are accessed through a smart-pointer or a synthesized attributed added with %extend is used. 08/22/2002: beazley Made more patches to hopefully eliminate problems when compiling SWIG as a 64-bit executable. 08/22/2002: beazley Fixed a bug with const reference members, variables, and static members. For example: class Foo { public: static const int &ref; }; SWIG was trying to generate "set" functions which wouldn't compile. 08/21/2002: beazley Made the warning message for "Class X might abstract" off by default. Enable with -Wall. 08/21/2002: beazley Refined handling of const and non-const overloaded methods. If a class defines a method like this: class Foo { public: int bar(int); int bar(int) const; } Then the non-const method is *always* selected in overloading and the const method silently discarded. If running with -Wall, a warning message will be generated. 08/19/2002: beazley Better support for using declarations and inheritance. Consider this: class Foo { public: int blah(int x); }; class Bar { public: double blah(double x); }; class FooBar : public Foo, public Bar { public: char *blah(char *x); using Foo::blah; using Bar::blah; }; Now SWIG wraps FooBar::blah as an overloaded method that uses all accessible versions of blah(). See section 15.2.2 in Stroustrup, 3rd Ed. SWIG also supports access change through using declarations. For example: class Foo { protected: int x; int blah(int x); }; class Bar : public Foo { public: using Foo::x; using Foo::blah; }; Caveat: SWIG does not actually check to see if declarations imported via 'using' are in the inheritance hierarchy. If this occurs, the wrapper code won't compile anyways---not sure it's worth worrying about. 08/18/2002: beazley Modified overloading dispatch to not include nodes with an "error" attribute. A language module can set this if a node couldn't be wrapped and you don't want it included in the dispatch function. 08/18/2002: beazley Enhancement to overloaded function dispatch. The dispatcher is now aware of inheritance relationships. For example: class Foo { }; class Bar : public Foo { }; void spam(Foo *f); void spam(Bar *b); In this case, the dispatcher re-orders the functions so that spam(Bar *b) is checked first---it is more specific than spam(Foo *f). 08/17/2002: beazley Added -Werror command line option. If supplied, warning messages are treated as errors and SWIG will return a non-zero exit code. 08/17/2002: beazley Fixed [ 596135 ] Typedef of reference can't compile. For example: typedef int &IntRef; void foo(IntRef i); SWIG-1.3.14 generated code that wouldn't compile. Version 1.3.14 (August 12, 2002) ================================ 08/11/2002: mmatus Static const members initialized during declaration, and only them, ie: struct A { static const int a = 1 ; // this one static const int b; // not this one }; are emitted like constants (equivalent to enums or explicit %constant). This is because they cannot be added directly to 'cvar' since they lack the needed reference (well, you can force them to have a real reference, but in an ugly way which goes completely again the original purpose of initialize them during declaration, you also have to deal with extra linking matters, and it take a while to figure out what is the problem and how to solve it). Please test it with your preferred target language, and not only the code generation, but really run the example in the test-suite (static-const-member-2.i) because the problem and the solution cannot be "fully" appreciated until you try to load the module and run it. In some target languages (python specially), this can produces a difference in the way that the static constant members 'a' and 'b' are internally wrapped. Hopefully, they still can be accessed in the same way. 08/11/2002: mmatus [python] Now static const members can be accessed in a more natural way, ie, if you have struct A { typedef unsigned int viewflags; static const viewflags forward_field = 0; static const viewflags backward_field; }; now you can do: print A.backward_field and also a = A() print a.forward_field Note that if the static const members don't have an initializer (like backward_field), still you can access them in the same way in the python side, but the implementation is a quite different: backward_field will still appear in the cvar entity, and also, you are responsible to initialize it in some code unit, and link it properly. forward_field, by the other hand, will not appear in the cvar entity but only as a A member, similar to what happen with enum or %constant members. 08/11/2002: mmatus [python] Common code in the __setattr__/__getattr__ now goes to two "free" methods at the beginning of the proxy file, from where each class use it. This change reduces the size of the proxy file, specially if you wrap a lot of small classes in one module (up to 33% in some cases), making it faster to load too. 08/09/2002: beazley [Perl5] If a function that returns char * returns NULL, undef is returned to the Perl interpreter. 08/09/2002: beazley Fix to conversion operators and namespaces. For example: namespace ns { struct Foo { }; struct Bar { operator Foo*(); }; } In the wrapper code, SWIG was using ->operator Foo*() when it should have been using ->operator ns::Foo*(). Note: if using %rename with a conversion operator, you might have to do this: %rename(toFooPtr) ns::operator ns::Foo*(); // ^^^^ note extra qualifier namespace ns { ... 08/09/2002: beazley [Python] Minor enhancement to 'const' variable declarations. Normally const declarations are wrapped as read-only variables accessible only through the cvar attribute (see SWIG.html for a discussion of why). However, in many programs, "const" declarations may just be constants---making the cvar. access awkward. To fix this, "const" declarations are now available both through cvar. and as a simple name. For example: const int FOO = 42; In Python: >>> print example.cvar.FOO 42 >>> print example.FOO 42 Note: There are cases where the value of a "const" variable might change. For example: char *const BAR = "Hello World"; In this case, the pointer itself can not change, but the data being pointed to could be modified. In these situations, cvar.BAR should be accessed to obtained the current value. 08/08/2002: beazley [Python] Fixed generation of the proxy code (.py files) to more closely follow the order of declarations as they appear in the .i file. In the past, all of the class wrappers appeared first, followed by function stubs, inserted Python code, and other details. 08/08/2002: cheetah (William Fulton) [Java] Proxy method _delete() changed to delete(). There shouldn't ever be a wrapped function called delete() as it is a C++ keyword and there is no such thing as a member function in C. *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE *** Backwards compatibility can be achieved by adding the function back in for all proxy classes: %typemap(javacode) SWIGTYPE %{ public void _delete() { delete(); } %} Java backwards compatibility summary ------------------------------------ There are a number of changes that have been made in improving the Java module for ver 1.3.14. If at all possible change your code to take advantages of the improvements. If you were using proxy classes you may not notice any backwards compatibility issues. Here is an example which will help with most backwards compatibility problems where it is not possible to modify the code that uses the generated output: Replace: %module modulename With: %module (jniclassname="modulename") modulename; %typemap(javacode) SWIGTYPE %{ public long getCPtr$javaclassname() { return swigCPtr; } public void _delete() { delete(); } %} %pragma(java) jniclassclassmodifiers="public"; The proxy constructors that took parameters (long cPtr, boolean cMemoryOwn) were public and are now protected. If you were making use of these then you'll have to modify your code and the best solution would be to use the new type wrapper classes. The other main areas are the pragmas and global variable wrapping. Replace the pragmas with one of the new directives or typemaps mentioned below and use %rename on the variables. If you were not using proxy classes, you will have to define a jstype typemap as well as a jtype typemap. 08/08/2002: cheetah (William Fulton) [Java] Fix for wrapping two dimension array variables. 08/07/2002: beazley [Python,Tcl] Object management now has a much better sense of ownership. Ownership bits is changed whenever an object is stored in a global variable or structure member. For example: struct Foo { int val; Foo *next; }; Now in Python >>> f = Foo() >>> f.thisown 1 >>> g = Foo() >>> g.next = f # Assign a pointer >>> f.thisown # Notice ownership change 0 >>> This scheme is mostly a conservative heuristic designed to provide segmentation faults. It could cause a memory leak if ownership is changed unnecessarily. In this case, you can either write a typemap (that doesn't change ownership), or manually set the thisown attribute back to 1. 08/07/2002: beazley [Tcl] Major usability improvements to the object interface. Suppose you had code like this: struct Foo { int x; int spam(); }; void blah(Foo *f); In past versions of SWIG, you could create objects and use them like this: % Foo f % f configure -x 3 % f spam 37 The only problem is that if you tried to call blah(), it didn't work: % blah f Type Error. Expected _p_Foo % Instead, you had to do this: % blah [f cget -this] SWIG now automatically extracts the -this pointer, avoiding this problem. This means that saying "blah f" is perfectly legal and everything will still work normally. Caveat: Since pointer strings start with a leading underscore (_), don't use this in object names. For example: % Foo _f % blah _f # Potential crash Objects now have a -thisown attribute that shows the ownership. This builds upon the CHANGES 11/24/2001 entry. 08/07/2002: samjam, Sam Liddicott Properly implemented pointer system using php resources. Still need to work out whether or not to let script-users call destructors directly 08/06/2002: beazley Upgraded mzscheme module to support version 201 and added overloading support. 08/05/2002: beazley Added parsing support for extra grouping (in very limited cases). For example: typedef int (FuncPtr)(int, double); *** EXPERIMENTAL *** 08/03/2002: ljohnson (Lyle Johnson) [Ruby] Updates to typemaps.i as those done previously for Perl, Python and Tcl modules. Now supports reference types with INPUT, OUTPUT and INOUT typemaps. 08/02/2002: beazley New library file cstring.i added. Provides macros for manipulating char * data. 08/02/2002: beazley Deprecated the %new directive. Use %newobject instead. For example: %newobject foo; ... char *foo(); %newobject follows the same rules as %rename, %ignore, %feature, etc. *** POTENTIAL INCOMPATIBILITY *** 08/01/2002: cheetah (William Fulton) [Java] New attribute 'jniclassname' for the module directive allows a way of changing the JNI class name from the default which uses the modulename with JNI appended after it. %module (jniclassname="name") modulename If 'name' is the same as 'modulename' then the module class name gets changed from 'modulename' to modulenameModule. 08/01/2002: beazley Fixed problem with file include order. Language specific directories should take precedence over generic directories. For example: "swig_lib/python/foo.i" should be loaded before "swig_lib/foo.i". I thought this was the case already, but apparently it has been broken for quite some time. 08/01/2002: beazley Added std_deque.i library file. Work in progress. 08/01/2002: beazley [Python,Tcl,Perl] Improvements to typemaps.i. INPUT/INOUT typemaps perform better error checking. Typemaps are now supplied for references like int &OUTPUT, double &INOUT, etc. 08/01/2002: beazley [Python] Deprecated the T_* and L_* typemaps in typemaps.i. Multiple return values are always placed in a tuple. Deprecated the BOTH typemaps. This is now INOUT (e.g., int *INOUT). *** POTENTIAL INCOMPATIBILITY FOR PYTHON MODULE *** 08/01/2002: beazley Deprecated the array.i, carray.i, and timer.i library files. 08/01/2002: beazley Deprecated the pointer.i library file. Use cpointer.i instead. *** POTENTIAL INCOMPATIBILITY *** 08/01/2002: cheetah (William Fulton) [Java] For consistency the global variable getters and setters use the JavaBean property design pattern like member variables always have. This means if you are wrapping a variable called foo, the getter is called getFoo() and the setter is called setFoo(). Before the recent changes to the Java module the getters and setters were called get_foo() and set_foo(). If you really want the original function names use the %rename directive like this: %rename(_foo) Foo; 07/31/2002: beazley Fixed casting problem with multiple inheritance. If you had this, class foo {}; class bar : public foo {}; class baz : public foo {}; class spam : public bar, public baz {}; then the wrappers wouldn't compile due to an ambiguous cast. Reported by Art Yerkes. 07/30/2002: cheetah (William Fulton) [Java] Due to new static typechecking all pointers held in a Java long are part of the internal workings and this pointer value in the Java long has become abstracted data. The type wrapper constructor and getCPtr() methods are as such protected. If you need to mess around with pointers from Java or for example create a proxy class or type wrapper class around a null pointer, add a function/constructor to do so with the %javacode typemap. You can also make getCPtr() public again with the %javagetcptr typemap. 07/30/2002: cheetah (William Fulton) [Java] Fixes for %typemap(ignore). In particular when ignoring the last parameter in a function. Also for all parameters in constructors. These mods have also fixed multi-argument typemaps for proxy classes - SF 581791. 07/30/2002: cheetah (William Fulton) [Java] %newobject (replacement for %new) now implemented for Java. 07/29/2002: beazley Fixed problem with typemap copies, %apply, and %clear inside C++ namespaces. 07/28/2002: cheetah (William Fulton) [Java] The JNI class now has package access as the class modifier has been changed from "public" to nothing. This has been done as this class is now more for the internal workings of SWIG since the module class has static type checking for all types. *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE *** Backwards compatibility can be achieved by using the %jniclassclassmodifier pragma to change it back to "public". 07/28/2002: cheetah (William Fulton) [Java] Proxy/Shadow classes are generated by default. The -proxy and -shadow command line options are deprecated. If you want to use the low-level functional interface then use the new -noproxy commandline option. *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE *** 07/28/2002: cheetah (William Fulton) [Java] Remaining pragmas shakeup. These were the remaining pragmas and their new names where changed: modulebase modulecode moduleclassmodifiers moduleimport => moduleimports moduleinterface => moduleinterfaces The moduleimports works slightly differently to how the moduleimport pragma worked. Now it actually takes code which gets placed before the class definition so the whole import statement has to be given, for example: %pragma(java) moduleimports=%{ import java.io.*; import java.math.*; %} The moduleinterfaces is slightly different to the old moduleinterface in that if more than one interface is required they must be comma separated in one use of the pragma, for example: %pragma(java) moduleinterfaces="Serializable, MyInterface" These last two pragmas are consistent with the javainterfaces and javaimports typemap. A similar set of pragmas has been introduced, namely: jniclassbase jniclasscode jniclassclassmodifiers jniclassimport jniclassinterface These work in the same way as their module counterparts. Note that previously the moduleXXX pragmas worked on the old module class which is now called the JNI class (the class with the native functions). The jniclassXXX pragmas now work on the new module class (the class that has all the global functions and global variable getters and setters when using proxy classes, plus all other remaining functions when using the low-level procedural interface). In summary the contents of the pragmas make up a class like this: class modulename extends implements { ... SWIG generated functions ... } } *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE *** 07/28/2002: cheetah (William Fulton) [Java] Deprecated modulemethodmodifiers pragma and replaced with a better %feature based directive called %javamethodmodifiers. A useful example would be for synchronisation in multi-threaded apps: %javamethodmodifiers foo(int a) "public synchronized"; Changes this function from the default ("public") to "public synchronized". *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE *** 07/26/2002: beazley Several directives now allow optional configuration parameters. These include: %module(name="value", name="value", ...) modulename %import(name="value", ...) "filename.i" %extend(name="value", ...) classname { ... } These currently have no effect and are reserved for future expansion. 07/26/2002: beazley Enhancements to smart-pointer handling. SWIG only provides extra support for a smart-pointer if operator->() returns a proper pointer. For example: Foo *operator->(); If operator->() returns an object by value or reference, then SWIG examines the returned object to see if it also implements operator->(). If so, SWIG chases operator->() until it can find one that returns a pointer. This allows cases like this to work: class Foo { public: void blah(); }; class Bar { ... Foo *operator->(); ... }; class Spam { ... Bar operator->(); ... }; For example: >>> s = Spam() >>> s.blah() # Invokes Foo::blah() The s.blah() call actually invokes: ((s.operator->()).operator->())->blah(); 07/26/2002: beazley Fixed a bug with typedef and references. For example: typedef Foo & FooRef; FooRef blah(); Previous versions of SWIG generated code that wouldn't compile. 07/25/2002: beazley Wrapping of static methods has been improved in proxy classes. In older versions of SWIG, if you had this: class Foo { public: static void bar(); }; The static method was only available as a function Foo_bar(). For example: >>> Foo_bar() Now, the static method can also be invoked through an instance like this: >>> f = Foo() >>> f.bar() # Invokes static method This works with all versions of Python. Additionally, for Python-2.2, the static method can be invoked as: >>> Foo.bar() The old-style function is still support for backwards compatibility. If you care about making your code across different versions of Python, either use Foo_bar() or access the method through an instance. 07/25/2002: beazley Changes to the Python module. Proxy classes now utilize new Python-2.2 features including properties and static methods. However, these features are supported in a way that provides backwards compatibility with older Python versions. In other words, proxy classes work with all versions of Python and only use new features when running on Python-2.2. 07/25/2002: beazley Modified %extend so that overloaded methods can be added. For example: %extend Foo { void bar(int x) { }; void bar(char *s) { }; ... } This works with both C++ *and* C. 07/24/2002: cheetah (William Fulton) [Java] More new typemaps so that the Java proxy classes and type wrapper classes can be further tailored by users. These are the default code for generating the finalize() methods (proxy classes only) and the getCPtr() methods for proxy classes and type wrapper classes: %typemap(javafinalize) SWIGTYPE %{ protected void finalize() { _delete(); } %} %typemap(javagetcptr) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] %{ public static long getCPtr($javaclassname obj) { return obj.swigCPtr; } %} The javagetcptr typemap will enable users to handle Java null by overriding this typemap - a requested feature. The -nofinalize commandline option has been deprecated. The javafinalize typemap is more powerful as it will allow the removal of the finalize methods for all or any one or more particular proxy class. 07/23/2002: cheetah (William Fulton) [Java] The getCPtrXXX() function has been changed to a static function and is now of the form: protected static long getCPtr(XXX obj) {...} This is a requested change which will allow Java null pointers to be used as null can be passed in for obj. However, to achieve this the appropriate code must be written using the new javagetcptr typemap directive. *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE *** Backwards compatibility can be achieved by adding this function back in using the new javacode typemap: %typemap(javacode) SWIGTYPE %{ // SWIG-1.3.12 and SWIG-1.3.13 public long getCPtr$javaclassname() { return swigCPtr; } // SWIG-1.3.11 and earlier public long getCPtr() { return swigCPtr; } %} 07/23/2002: cheetah (William Fulton) [Java] New directive to control constant code generation - %javaconst. The default handling for handling constants is to get the value through a JNI call, eg #define YELLOW 5 #define BIG 1234LL results in: public final static int YELLOW = modulename.get_YELLOW(); public final static long BIG = modulename.get_BIG(); Earlier versions of the Java module initialised the value using the C value: public final static int YELLOW = 5; public final static long BIG = 1234LL; This works in most cases, but the value for BIG won't compile as 1234LL is not valid Java code and this is one of the reasons why the default is now to get the values through a JNI call. The side effect is that these 'constants' cannot be used in switch statements. The %javaconst directive allows one to specify the way the constant value is initialised and works like other %feature directives, eg %javaconst(0); // all constants from this point on are initialised using the C value %javaconst(1) BIG; // just BIG initialised using JNI call (must be parsed before BIG is defined) 07/23/2002: beazley *** IMPORTANT CHANGES TO THE PYTHON MODULE *** (1) The Python module now enables shadow/proxy classes by default. This means that two files are always created by SWIG. For instance, if you have this: // file: foo.i %module foo ... Then swig generates two files "foo_wrap.c" and "foo.py". (2) The name of the low-level C extension module has been changed to start with a leading underscore. This means that you have to compile the module as follows: $ cc -c -I/usr/local/include/python2.2 foo_wrap.c $ cc -shared foo_wrap.o $(OBJS) -o _foo.so ^^^^ note extra underscore This naming scheme is consistent with other Python modules that utilize extension code. For instance, the socket module consists of "_socket.so" and "socket.py". In previous versions of SWIG, the shared object file was named "foocmodule.so". (3) A new directive can be used to insert Python code into the corresponding .py file. For example: %pythoncode %{ def foo(): print "Hello World" %} This directive allows you to create modules as a mix of C and Python. Python code is seamlessly added to the module. (4) The -shadow command line option is deprecated. This is turned on by default. (5) To disable the generation of the extra python file, use the "-noproxy" command line option. *** POTENTIAL INCOMPATIBILITY *** This change will likely break the build environment of projects that utilize shadow classes. To fix this, you probably only need to change the name of the target .so file. For example, if you have Makefile information like this: TARGET = examplecmodule.so Just change it to: TARGET = _example.so *** DOCUMENTATION UPDATE *** The file Doc/Manual/Python.html has been updated to describe these changes. 07/23/2002: beazley Added -noextern option. If supplied, SWIG will not generate extra extern declarations. This is sometimes an issue on non-unix platforms. 07/23/2002: beazley Added a warning for ignored friend functions. 07/23/2002: beazley Fixed [ 574498 ] -proxy and %include "pointer.i" clash. Reported by David Creasy. 07/23/2002: beazley Fixed [ 576103 ] global destruction warning with shadow. Perl extensions should no longer report the warning "Use of uninitialized value during global destruction." when running with "perl -w". Reported by Brett Williams. 07/23/2002: beazley In C++ mode, SWIG now always defines namespace std. By default, it's empty. However, this will silence errors from programs that include statements such as "using namespace std;". This fixes Bug [ 584017 ] using namespace std generates error. Reported by Joseph Winston. 07/22/2002: beazley Added a new warning message for %apply. If you use %apply but no typemaps are defined, you will get a warning message. This should help with problems like this: %apply char *OUTPUT { ... }; In old versions of SWIG, this silently did nothing. Now you get an error like this: file:line. Warning. Can't apply (char *OUTPUT). No typemaps are defined. 07/22/2002: cheetah (William Fulton) [Java] Started Java pragma deprecation. Replacements use %typemap based directives and enable proxy classes and the new type wrapper classes to be tailored in various ways. These are the new typemaps: %typemap(javabase) - base (extends) for Java class %typemap(javaclassmodifiers) - class modifiers for the Java class: default is "public" %typemap(javacode) - java code is copied verbatim to the Java class %typemap(javaimports) - import statements for Java class %typemap(javainterfaces) - interfaces (extends) for Java class And these are the %pragma directives being deprecated: allshadowbase allshadowclassmodifiers allshadowcode allshadowimport allshadowinterface shadowbase shadowclassmodifiers shadowcode shadowimport shadowinterface Note that it is possible to target a particular proxy class: %typemap(javaimports) Foo "import java.util.*"; or a particular type wrapper class: %typemap(javaimports) double* "import java.math.*"; Note that $javaclassname in these typemaps are substituted with either the proxy classname when using proxy classes or the SWIGTYPE class name. 07/18/2002: cheetah (William Fulton) [Java] Java module overhaul to implement static type checking of all types. 1) Changes when using Java Proxy classes ---------------------------------------- Previously when wrapping global functions: class SomeClass{}; void foo(SomeClass* s); SomeClass* bar(); The native method prototypes used a long for pointers and looked like this: public class modulename { ... public final static native void foo(long jarg1); public final static native long bar(); } and unlike member functions of a C++ class there was no wrapper around the native calls to make the use of them more user friendly. They would be used from Java like this: SomeClass s = new SomeClass(modulename.bar(), false); modulename.foo(s.getCPtrSomeClass()); Note that the following will have the same effect, but then it would not have been possible to call any proxy member functions in SomeClass: long s = modulename.bar(); modulename.foo(s); Now wrapper functions are generated: public class modulename { public static void foo(SomeClass s) { // calls the native function } public static SomeClass bar() { // calls the native function } } Which means these functions can now be used more naturally with proxy classes: SomeClass s = modulename.bar(); modulename.foo(s); 2) Changes when not using Java Proxy classes -------------------------------------------- The so called low-level interface was rather low-level indeed. The new static type checking implementation makes it less so but it remains a functional interface to the C/C++ world. Proxy classes are the obvious way to use SWIG generated code, but for those who want a functional interface all non-primitive types now have a simple Java class wrapper around the C/C++ type. Pointers and references to primitive types are also wrapped by type wrapper classes. The type wrapper classnames are based on the SWIG descriptors used by the other language modules. For example: C/C++ type Java type wrapper class name ---------- ---------------------------- int* SWIGTYPE_p_int double** SWIGTYPE_p_p_double SomeClass* SWIGTYPE_p_SomeClass SomeClass& SWIGTYPE_p_SomeClass SomeClass SWIGTYPE_p_SomeClass Note that everything wrapped by SWIG is accessed via a pointer even when wrapping functions that pass by value or reference. So the previous example would now be used like this: SWIGTYPE_p_SomeClass s = example.bar(); example.foo(s); Note that typedefs that SWIG knows about are resolved, so that if one has class Foo{}; typedef Foo Bar; then any use of Bar will require one to use SWIGTYPE_p_Foo; Some considerations: Make sure you make a firm decision to use either proxy classes or the functional interface early on as the classnames are different. 3) Pointers and non-parsed types -------------------------------- Sometimes SWIG cannot generate a proxy class. This occurs when the definition of a type is not parsed by SWIG, but is then used as a variable or a parameter. For example, void foo(Snazzy sds); If SWIG has not parsed Snazzy it handles it simply as a pointer to a Snazzy. The Java module gives it a type wrapper class around the pointer and calls it SWIGTYPE_p_Snazzy. In other words it handles it in the same manner as types are handled in the low-level functional interface. This approach is used for all non-proxy classes, eg all pointer to pointers and pointers to primitive types. 4) Backwards compatibility ----------------------- Backwards compatibility is not an issue if you have been using proxy classes and no global variables/functions. Otherwise some changes will have to be made. The native methods still exist but they are now in a JNI class, which is called modulenameJNI. As this class is really part of the internal workings, it should not be required so the class has become protected. Some pragmas/directives will hopefully be added to help with backwards compatibility. *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE *** 07/18/2002: beazley Modified wrapping of uninstantiated templates returned by value. Just to be safe, they are now wrapped by SwigValueWrapper<> just in case they don't define a default constructor. This would be used if you had code like this Foo blah(); void moreblah(Foo x); but you didn't instantiate Foo using %template. We should probably add a warning for this. 07/17/2002: beazley Added an error check to detect shadowed template paramaters. For example: template class Foo { public: int T; }; This results in an error, not a warning. This warning is also needed to fix some rather insidious problems like this: struct T { int blah; }; template class Foo { public: typedef T Traits; // Which T is this???? }; In this case, the template parameter T shadows the outer structure (which is what you want). 07/16/2002: beazley Improved support for templates with integer arguments. SWIG is much more aware of situations such as this: const int Size = 100; %template(Foo100) Foo<100>; void bar(Foo *x); // Knows that Foo is the same as Foo<100>; 07/15/2002: beazley Fixed bug with %feature/%ignore/%rename and namespaces. For example: %ignore Foo::Bar namespace Foo { class Bar { ... }; } Reported by Marcelo Matus. 07/09/2002: beazley Added parsing support for constructors that try to catch exceptions in initializers. For example: class Foo { Bar b; public: Foo(int x) try : b(x) { ... } catch(int) { ... } } This has no effect on the generated wrappers. However, the try and catch parts of the declaration are ignored. See Stroustrup, 3rd Ed, section 14.4.6.1 for details. 07/06/2002: beazley Fixed bug in template symbol table management. This fixes two bugs. First, mixing abstract methods, templates, and inheritance no longer generates a failed assertion. template class A { public: virtual void foo() = 0; }; template class B : public A { }; %template(A_int) A; %template(B_int) B; This fix also fixes a subtle problem with default values and templates. For example: template struct B { typedef unsigned int size_type; static const size_type nindex = static_cast(-1); void foo(size_type index = nindex); }; Bugs reported by Marcelo Matus. 07/05/2002: ljohnson (Lyle Johnson) [Ruby] Changed the definition of the SWIG_ConvertPtr() function for the SWIG/Ruby runtime support so that it looks like the Python version. If the last argument (flags) is non-zero, SWIG_ConvertPtr() will raise an exception for type mismatches as before. If flags is zero, this function will return -1 for type mismatches without raising an exception. *** POTENTIAL INCOMPATIBILITY FOR RUBY MODULE *** 07/04/2002: beazley Overloaded functions/methods/constructors now work in many language modules. The support is completely transparent--just call the function normally and SWIG will dispatch to the correct implementation. There are a variety of issues associated with this. Please refer to the overloading section of Doc/Manual/SWIGPlus.html for details. *** NEW FEATURE *** 07/04/2002: beazley Fixed a bug with namespaces, enums, and templates. For example: namespace hello { enum Hello { Hi, Hola }; template struct traits { typedef double value_type; }; traits::value_type say_hi() { return traits::value_type(1); } } SWIG wasn't generating wrappers that properly qualified traits. Reported by Marcelo Matus. 06/30/2002: beazley Supplied array variable typemaps for Tcl module. If you have a variable like this: int foo[10]; then a set function like this is generated: void foo_set(int *x) { memmove(foo,x,10*sizeof(int)); } 06/30/2002: beazley New %fragment directive. When writing typemaps, it can be easy to get carried away and write a lot of code. However, doing so causes tremendous code bloat. A common way to solve this is to write helper functions. For example: %{ void some_helper_function() { ... } %} %typemap(in) type { some_helper_function(...); } The only problem with this is that the wrapper file gets polluted with helper functions even if they aren't used. To fix this, a new fragment directive is available. For example: (corrected typo in line below - 06/26/2008) %fragment("type_header","header") %{ void some_helper_function() { ... } %} %typemap(in, fragment="type_header") type { some_helper_function(...); } In this case, the code fragment is only emitted if the typemap is actually used. A similar capability is provided for declaration annotation and the %feature directive. For example: %feature("fragment","type_header") SomeDeclaration; The first argument to %fragment is the fragment name. The second argument is the file section where the fragment should be emitted. The primary use of this directive is for writers of language modules and advanced users wanting to streamline typemap code. *** EXPERIMENTAL NEW FEATURE *** 06/30/2002: beazley Supplied memberin typemaps for all arrays in an attempt to eliminate confusion about their use. 06/29/2002: beazley Experimental support for smart-pointers. When a class defines operator->() like this class Foo { ... Bar *operator->(); ... }; SWIG locates class Bar and tries to wrap its member variables and methods as part of Foo. For example, if Bar was defined like this: class Bar { public: int x; int spam(); }; You could do this (in the target language): f = Foo() f.x = 4 # Accesses Bar::x f.spam() # Accesses Bar::spam The primary use of this feature is to emulate the behavior of C++ smart-pointers---which allow attributes to accessed transparently through operator->. This feature is supported automatically in SWIG---no special directives are needed. To disable this behavior. Use %ignore to ignore operator->. *** NEW FEATURE *** 06/26/2002: beazley Deprecated the %except directive. %exception should be used instead. 06/25/2002: beazley Major cleanup of the modules directory. Eliminated most header files, consolidated module code into single files. 06/24/2002: beazley Reworked the instantiation of language modules. All language modules must now define a factory function similar to this: extern "C" Language * swig_python(void) { return new PYTHON(); } This function is then placed in a table and associated with a command line option in swigmain.cxx. This approach has a number of benefits. It decouples the SWIG main program from having to know about the class definitions for each module. Also, by using a factory function, it will be easier to implement dynamic loading of modules (simply load the file and invoke the factory function). 06/24/2002: beazley Fixed syntax error for reference conversions. For example: operator Foo &(); 06/24/2002: beazley Fixed syntax error for operator new[] and operator delete[]. 06/24/2002: beazley Fixed code generation problem for constants and default arguments involving templates. 06/19/2002: ljohnson (Lyle Johnson) [Ruby] Fixed a bug for the '-feature' command line argument; that setting was effectively being ignored and so the feature name was always set equal to the module name. 06/17/2002: beazley Fixed problems with static members and enums in templates. Version 1.3.13 (June 17, 2002) ============================== 06/16/2002: beazley Fixed a bug with __FILE__ expansion in the preprocessor. On Windows, the backslash (\) is now converted to (\\) in the string literal used for __FILE__. Reported by Steve Glaser. 06/14/2002: beazley Fixed warning message about 'name private in this context'. The warning is only generated for public methods. Reported by Scott Michel. 06/14/2002: beazley Fixed some problems related to template instantiation and namespaces. When SWIG expands a template, it does so with fully resolved types. For example, if you have this: template class foo { }; typedef double Double; %template(foo_d) foo; then, it is handled as foo in the typesystem. This fixes a number of subtle problems with inheritance and templates. 06/14/2002: ljohnson (Lyle Johnson) [Ruby] Added missing bool typemaps for INPUT, OUTPUT and INOUT in Lib/ruby/typemaps.i. 05/29/2002: cheetah (William Fulton) [Java] Fix for a couple of broken pragmas. 05/29/2002: cheetah (William Fulton) Fix for unnecessary cast when wrapping global variable where the type is not parsed by SWIG - Java variables example failure as reported by Larry Virden. 06/10/2002: beazley Modified %template to allow for empty instantiations. %template() foo; This registers foo with the type system, but doesn't wrap it (same as %ignore). This may only be a temporary measure. SWIG might be able to automatically instantiate templates in certain cases. 06/10/2002: beazley Fixed function prototype problems with Tcl 8.4 06/09/2002: beazley Fixed problem with templates and location of base classes. This one is a little mind-bending, but here is an example that illustrates: template struct traits { typedef ArgType arg_type; typedef ResType res_type; }; template struct Function { }; template struct Class : Function::arg_type, typename traits::res_type> { }; %template(traits_dd) traits ; %template(Function_dd) Function ; %template(Class_dd) Class ; In this example, the base class of 'Class' is determined from the Function template, but the types are obtained through typedefs. Because of this, SWIG could not locate the wrapped base class (Function). Should be fixed in 1.3.13 even though I can think of a million other things that might also be broken. 06/07/2002: beazley Fixed a problem with conversion operators. If you had an operator like this, operator double() const; SWIG was ommitting the "const" qualifier. This affected %rename and other directives. Reported by Zhong Ren. 06/07/2002: beazley Lessened the strictness of abstract class checking. If you have code like this: class Foo { public: virtual int method() = 0; }; class Bar : public Foo { public: Bar(); ~Bar(); }; SWIG will go ahead and generate constructor/destructors for Bar. However, it will also generate a warning message that "Bar" might be abstract (since method() isn't defined). In SWIG-1.3.12, SWIG refused to generate a constructor at all. 06/07/2002: beazley Change to %template directive. If you specify something like this: %template(vi) std::vector; It is *exactly* the same as this: namespace std { %template(vi) vector; } SWIG-1.3.12 tried to instantiate the template outside of the namespace using some trick. However, this was extremely problematic and full holes. This version is safer. 06/07/2002: beazley Fixed bug with scope qualification and templates. For example: A::DD Before, this was separated as scopes A, and DD. Fixed now. 06/06/2002: beazley Allow the following syntax: class A { }; struct B : A { ... }; A base class without a specifier is assumed to be public for a struct. 06/06/2002: beazley Fixed syntax error with template constructor initializers. Reported by Marcelo Matus. 06/06/2002: beazley Fixed bug with default template arguments. Reported by Marcelo Matus. 06/05/2002: beazley Fixed subtle problems with %rename directive and template expansion. Code like this should now work: %rename(blah) foo::method; ... template class foo { public: void method(); }; %template(whatever) foo; 06/05/2002: beazley Resolved some tricky issues of multi-pass compilation and and inheritance. The following situation now generates an error: class Foo : public Bar { ... }; class Bar { ... }; The following code generates a warning about incomplete classes. class Bar; class Foo : public Bar { }; The following code generates a warning about an undefined class. class Foo : public Bar { }; // Bar undefined This fixes a failed assertion bug reported by Jason Stewart. 06/05/2002: ljohnson [Ruby] Added a warning message for the Ruby module about the lack of support for multiple inheritance. Only the first base class listed is used and the others are ignored. (Reported by Craig Files). 06/03/2002: beazley Fixed a bug with struct declarations and typedef. For example: typedef struct Foo Foo; struct Foo { ... }; A few other subtle struct related typing problems were also resolved. Version 1.3.12 (June 2, 2002) ============================= 05/30/2002: beazley Fixed problem related to forward template class declarations and namespaces. Bug reported by Marcelo Matus. 05/30/2002: beazley Added 'make uninstall' target. Contributed by Joel Reed. 05/29/2002: beazley Fixed rather insidious bug with %rename, %feature and template specialization. For example: %exception vector::__getitem__ { ... some exception ... } template class vector { ... T __getitem__(int index); // Fine ... }; template<> class vector { ... T __getitem__(int index); // Oops. ... }; Now, the %exception directive (and other features) should correctly apply to both vector and specializations. 05/29/2002: beazley Subtle changes to %template() directive. Template arguments are now reduced to primitive types in template matching. For example: template class vector { ... partial specialization ... } typedef int *IntPtr; // Gross typedef // Gets the above partial specialization %template(vectorIntPtr) vector; This change is extremely subtle, but it fixes a number of potential holes in Luigi's STL library modules. For example: typedef int Integer; %template(vectori) vector; 05/29/2002: beazley Fixed rather insidious typemap bug related to const. const was being discarded through typedefs. 05/29/2002: ljohnson (Lyle Johnson) [Ruby] Added input typemaps for const references to primitive types (in Lib/ruby/ruby.swg). 05/29/2002: cheetah (William Fulton) [Java] The java arrray support functions are enclosed by a SWIG_NOARRAYS #define. Useful if not using arrays and it is desirable to minimise the amount of compiled code. 05/29/2002: cheetah (William Fulton) [Java] Enums were not renamed when using %name or %rename fix. 05/28/2002: ljohnson [Ruby] Modified the name of the wrapper functions for the "new" singleton method and "initialize" instance method for consistency with the other language modules. The wrapper name for the function that implements "new" is alloc_classname and the wrapper name for the function that implements "initialize" is new_classname. 05/27/2002: beazley Changes to runtime. Pointer conversion/creation functions now almost always have an extra "flags" argument. For example: SWIG_ConvertPtr(obj, void **, swig_type_info *ty, int flags); ^^^^^^^^^^ This extra parameter is reserved for future expansion and will be used for more control over pointers in future versions. 05/27/2002: beazley Fix for C++ classes with private assignment operators. It is now possible to safely return objects like this by value. Caveat: the class must provide a copy constructor. 05/26/2002: beazley -proxy option added to many language modules. This is the same as -shadow. We are merely changing terminology. 05/26/2002: beazley [perl] Fixed some inconsistencies in the -package option. -package merely sets the package name to be used on the wrappers. It does not change the name of the shared library file or the name of the generated .pm file. This was broken at some point, but works again now. 05/25/2002: beazley [perl] Fixed [ 475452 ] memory leak in return-by-value. Problem related to static member variables returning newly allocated objects. Reported by Roy Lecates. 05/25/2002: beazley [perl] Fixed [ 513134 ] %BLESSEDMEMBERS isn't always right. Reported by Fleur Diana Dragan. 05/25/2002: beazley Fixed [ 540735 ] -importall and the -I option. 05/25/2002: beazley [guile] Fixed [ 532723 ] Default arg for char* can SegV. Error in guile module. Reported by Brett Williams. 05/25/2002: beazley Subtle change to typemap application code. The "freearg" typemap must exactly match up with the "in" or "ignore" typemap. For example: %typemap(in) (char *data, int len) { ... }; %typemap(freearg) char *data { ... }; void foo(char *data, int len); In this case, the "in" typemap is applied, but the freearg typemap is not. This is because the freearg typemap doesn't match up with the input argument sequence. 05/25/2002: beazley Fixed [ 548272 ] Default argument code missing braces. Reported by Brett Williams. 05/25/2002: beazley Fixed [ 547730 ] SwigValueWrapper needed for constructors. Reported by William Fulton. 05/25/2002: beazley Undefined identifiers now evaluate to 0 when evaluating preprocessor expressions. For example: #if !FOO ... #endif where FOO is undefined or set to some non-numeric value. Fixes [ 540868 ] #if defined whatever - not parsed. Reported by Adam Hupp. 05/24/2002: beazley SWIG now ignores the C++ 'export' keyword. 05/23/2002: beazley Some refinement of type-name mangling to account for pointers, arrays, references, and other embedded type constructs. 05/23/2002: beazley Initial attempt at supporting template partial specialization. At the very least, it is parsed and the classes are stored. Matching of instantiations to specialized version is more limited and based on the SWIG default typemap rules: SWIGTYPE * SWIGTYPE [] SWIGTYPE & Now, why in the world would you want to use this feature? Other than allowing for slightly modified class APIs, this capability is primarily used to provide advanced wrapping support for STL-like objects. It can also be mixed with typemaps. Here is an example: /* Generic version */ template class vector { %typemap(in) vector * { // A container of objects } }; /* Partial specialization (pointers) */ template class vector { %typemap(in) vector * { // A container of pointers to objects. } }; /* Specialization (integers). */ template<> class vector { %typemap(in) vector * { // A container of integers. } }; *** EXPERIMENTAL FEATURE *** 05/23/2002: beazley Enhancement to typemaps. Normally, typemap variables are renamed to avoid conflicts. For example: %typemap(in) int * (int temp) { $1 = &temp; } This results in code that creates and uses variables "temp1","temp2", "temp3" and so forth depending on how many times the typemap is used. Sometimes you want a single variable instead. To do that, using the following naming scheme: %typemap(in) int *(int _global_temp) { } Is this case, a single variable _global_temp is emitted in the wrapper functions. It is shared across all typemaps. Repeated typemaps do not replicate the variable---they use the first one emitted. *** NEW FEATURE *** 05/23/2002: beazley Minor enhancement to typemaps. If you have this code, %typemap(in) Foo (int somevar = 3) { ... } the default value for somevar is now emitted into the wrapper code. 05/22/2002: beazley Fixed %extend to be better behaved in namespaces. If you have code like this: namespace foo { struct bar { %extend { void blah(); }; }; } SWIG matches the blah() method to a C function named void foo_bar_blah(foo::bar *self). This is consistent with the non-namespace version. Bug reported by Marcelo Matus. 05/22/2002: beazley New library files: cpointer.i, carrays.i, cmalloc.i. These provide access to C pointers and memory allocation functions. See Doc/Manual/Library.html for details. 05/22/2002: cheetah (William Fulton) [Java] C type char no longer maps to Java type byte, but to Java type char. It is now treated as a character rather than a signed number. This fits in with the other language modules and is a more natural mapping as char* is mapped as a string of characters. Note that the C signed char type is still mapped to a Java byte. *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE *** 05/22/2002: cheetah (William Fulton) [Java] Improved constants wrapping. Constants (#define and %constant) values are now obtained through a JNI call. Previously the value was compiled as Java code, but this didn't work for all cases, eg #define 123ULL. 05/22/2002: beazley Fixed bogus error message with %extend directive and C++ access specifiers. Reported by Marcelo Matus. 05/22/2002: beazley Namespaces and enums now work correctly. For example: namespace Foo { enum Bar { A, B }; } Bug reported by Marcelo Matus. 05/21/2002: beazley The %types directive can now be used to specify inheritance relationships in the runtime type system. For example, %types(Foo = Bar); specifies that Foo isa Bar. Using this is potentially quite dangerous. However, this is useful in certain cases (and in the SWIG library). 05/20/2002: beazley %nodefault and %makedefault directives now require a trailing semicolon. For example: %nodefault; ... %makedefault; In addition both directives can take a class name. For example: %nodefault Foo; class Foo { /* No default constructor/destructor */ }; class Bar { /* Default constructor/destructor generated */ }; *** POTENTIAL INCOMPATIBILITY *** If you don't use the trailing semicolon, things will mysteriously break. 05/20/2002: beazley More improvements to type system handling. SWIG now correctly handles template names and parameters in a namespace. For example: namespace foo { template class bar { }; typedef int Integer; void blah(bar *x); }; In the generated code, all of the typenames are properly qualified. 05/17/2002: cheetah (William Fulton) [Java] deprecated broken -jnic and -jnicpp commandline options. The C or C++ JNI calling convention is now determined from the -c++ commandline option. 05/16/2002: cheetah (William Fulton) [Java] The JCALL macros which exist so that the same typemaps can be used for generating both the C and C++ JNI calling conventions no longer appear in the generated code. This is because the output is now passed through the SWIG preprocessor which does the macro expansion for either C or C++ (depending on whether -c++ is passed on the SWIG commandline). The generation of the functions used in the array typemaps have been adjusted to take account of this. The side effect is that any typemaps which contained JCALL macros within %{ %} brackets will have to be moved within {} brackets so that the SWIG preprocessor can expand the macros. *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE *** 05/13/2002: beazley Class templates may now be used as template parameters. For example: template class C> class Foo { ... }; template class Bar { ... }; %template(Fooi) Foo; SWIG doesn't really do anything special with this---it's just another way of specifying a template parameter. 05/13/2002: beazley Minor refinement of template support. Template parameter names are no longer required for types. For example: template class Foo { }; Obviously, names are required for template; 05/12/2002: beazley New macro expansion in typemaps. The sequence: $descriptor(type) Will expand into the SWIG type descriptor structor for the given type. Type may be any abstract datatype. For example: $descriptor(int *) $descriptor(int (*)(int,double)) $descriptor(vector *) Caveat: It is *NOT* currently legal to use other typemap substitution variables in the macro. For example $descriptor($1_type). The primary purpose of this modification is to better support typemaps for container objects or to allow typemaps that might be performing type conversions. *** NEW FEATURE *** 05/11/2002: beazley The wrapping of references to primitive types has been changed as follows: Arguments of type 'const primitive &' are now passed by value as opposed to pointers. Return values of type 'const primitive &' are returned as values instead of pointers. 'primitive' is any one of int, short, long, long long, char, float, double, bool (as well as unsigned variants). This change is being made to better support C++ wrapping--especially code that makes use of templates and the STL. 05/11/2002: beazley The %template directive can now be used to access templates in a namespace. For example: namespace std { template class complex { T re, im; public: complex(T _r = T(), T _i = T()) : re(_r), im(_i) { } T real() { return re; } T imag() { return im; } }; } %template(complex) std::complex; Note: There are some very subtle namespace/symbol table management issues involved in the implementation of this. It may not work in certain cases. 05/10/2002: beazley Member template constructor support added. For example: template struct pair { _T1 first; _T2 second; pair() : first(_T1()), second(_T2()) { } template pair(const pair<_U1,_U2> &x); }; To instantiate the template, use %template and %extend. For example, this expands the constructor into a default copy constructor: %extend pair { %template(pair) pair<_T1,_T2>; } Highly experimental. Other uses may be broken. 05/10/2002: beazley The %extend (%addmethods) directive no longer works unless it appears in the public section of a class. An error message is now generated (as opposed to a segmentation fault). 05/09/2002: beazley New %warnfilter() directive. This directive attaches a warning filter to specific declarations and has the same semantics as %rename, %ignore, %feature, and so forth. For example: %warnfilter(501) foo; // Suppress overloaded warning int foo(int); int foo(double); or %warnfilter(501) Object::foo(double); class Object { public: int foo(int); int foo(double); }; This feature only suppresses warnings in later stages of code generation. It does not suppress warnings related to preprocessing or parsing. *** NEW FEATURE *** 05/09/2002: beazley SWIG now supports C99 variadic preprocessor macros. For example: #define debugf(fmt,...) fprintf(stderr,fmt,__VA_ARGS__) The argument "..." is used to indicate variable arguments which are all placed into the special argument name __VA_ARGS__ in the macro expansion. SWIG also implements the GNU (##) extension for swallowing the preceding comma when __VA_ARGS__ is empty. For example: #define debugf(fmt,...) fprintf(stderr,fmt, ##__VA_ARGS__) Here is how this is expanded: debugf("%d", 3) --> fprintf(stderr,"%d",3) debugf("Hello") --> fprintf(stderr,"Hello" ) (notice the deleted comma). *** NEW FEATURE *** 05/08/2002: samjam (Sam Liddicott) Many changes to php module. Shadow classes are now implemented entirely in native C and no need for php-code shadow wrappers Populated template config.m4 and Makefile.in as needed by phpize are generated. 05/08/2002: ljohnson (Lyle Johnson) [Ruby] A copy constructor is now turned into a "clone" instance method (see Dave's change for copy constructors dated 4/7/2002). This seems like the appropriate thing to do for Ruby code. 05/08/2002: ljohnson (Lyle Johnson) [Ruby] Fixed [ 553864 ] Inline destructor code not written. 05/08/2002: beazley %ignore behaves better with constructors, destructors, and the type system in general. For constructors and destructors, %ignore now suppresses the creation of a default constructor or destructor. For example: %ignore ~Foo; class Foo { public: Foo(); ~Foo(); ... }; In SWIG-1.3.11, ~Foo() simply "disappeared" and the code generator created a wrapper for a default destructor (as if it was never declared in the interface). In SWIG-1.3.12, %ignore suppresses the creation of a destructor if one is actually defined. Similarly, even though a declaration is ignored, information may still be needed to properly handle types. For example, here is a very subtle error that is fixed by this change: %ignore std::string; // Prevent class wrapping namespace std { class string { ... }; %typemap(in) string * { ... } } void foo(std::string *s); // Broken. Before this fix, %ignore would cause the class definition to disappear. This, in turn, would cause the typemap to be misapplied. 05/08/2002: beazley Minor changes to %rename, %ignore, %feature, and related directives for better support of destructors. Destructors can now be precisely tagged. For example: %ignore Foo::~Foo; %feature("action") ~Bar { ... } *Developer warning* Operations such as renaming and feature attachment for classes used to be applied to destructors as well. For instance, if you did this: %rename(Bar) Foo; The operation applied to the class itself, the constructor, and the destructor. This is no longer the case. Now such operations will only apply to the class and the constructor. Note: if you were relying on this for class renaming, be aware that renamed classes should really only be handled at the level of the class itself and not the level of individual declarations in the class (although they can be renamed individually if needed). As far as I know, the Language class is already taking care of this case correctly. 05/07/2002: beazley New set of tests. The Examples/test-suite/errors directory contains tests that try to exercise all of SWIG's error and warning messages. 05/07/2002: beazley Start of a warning framework. Warning messages are now assigned numeric values that are shown in warning messages. These can be suppressed using the -w option. For example: swig -w302 example.i swig -w302,305 example.i Alternatively, the #pragma preprocessor directive can be used to disable this: #pragma SWIG nowarn=302 #pragma SWIG nowarn=302,305 Note: Since SWIG is a multi-pass compiler, this pragma should only be used to change global settings of the warning filter. It should not be used to selectively enable/disable warnings in an interface file. The handling of #pragma occurs in the C++ preprocoessor and affects all subsequent stages of compilation. The -Wall option turns on all warnings and overrides any filters that might have been set. Warnings can be issued from an interface using %warn. For example: %warn "110:%section is deprecated" The first part of a warning message is an optional warning number. A complete set of warning numbers is found in Source/Include/swigwarn.h. *** NEW FEATURE *** 05/07/2002: beazley Internal parsing change. Directives to include files now use brackets [ ... ] instead of { ... }. %includefile "foo.i" [ ... ] The use of { ... } was a bad choice because they were included implicitly by the preprocessor and made it impossible to properly detect legitimate missing '}' errors. 04/16/2002- 05/02/2002: beazley SWIG European Tour: Paris-Amsterdam-Bath. 04/23/2002: beazley The %addmethods directive has been renamed to %extend. For example: class Foo { ... }; %extend Foo { int blah() { ... }; int bar() { ... }; ... }; Motivation: the %addmethods directive can be used for many other tasks including adding synthesized attributes, constructors, and typemaps. Because of this, "addmethods" is somewhat misleading. %extend more precisely describes this operation---extension of a class or structure. *** POTENTIAL INCOMPATIBILITY *** %addmethods still works via a macro definition. However, a warning message may be generated. Errors involving %addmethods will actually refer to the %extend directive. 04/23/2002: beazley Further refinement of the type system. Typedef now propagates through functions, pointers to functions, and pointers to member functions. For example: typedef int Integer; void foo(int (*x)(int), Integer (*y)(Integer)); In this case, arguments 'x' and 'y' have exactly the same type (and would obviously accept objects of either type). Similarly, consider this: class Foo { }; typedef Foo Bar; void bar(int (Foo::*x)(int), int (Bar::*y)(int)); In this case, arguments x and y are the same type (via typedef). 04/22/2002: beazley SWIG now generates a warning message if any part of an expression involves values from a private part of a class. For example: class Foo { private: static int X; public: void blah(int a, int b = X); // Warning }; In this case, the default argument is ignored. There are workarounds, but they are rather clumsy. For instance, you might do this: %feature("action") blah(int,int) { if ($nargs == 1) { result = blah(arg1); } else { result = blah(arg1,arg2); } } void blah(int a, int b = 0); 04/21/2002: beazley Use of the %inline directive inside a namespace is forbidden and now generates an error message. This is not allowed since the inlined code that is emitted is not placed inside a namespace. This confuses other stages of parsing. 04/21/2002: beazley Some bug fixes to casting operations and expression parsing. Due to some parsing issues, it is not currently possible to use casts for all possible datatypes. However, the common cases work. 04/20/2002: beazley (Amsterdam) Member templates now work. Simply use the %template directive inside a class or %addmethods to create instantiations (see Doc/Manual/SWIGPlus.html). Supporting this was easy---earlier changes to templates made it possible using only a two-line modification to the parser and a few minor modifications elsewhere. Hmmm, come to think of it, the smoke was rather thick in that Internet "cafe". *** NEW FEATURE *** 04/19/2002: beazley (TGV) Improved handling of non-type template parameters. For example: vector; Simple numbers and strings can be used with the %template directive as well. For example: %template(vecint100) vector; Note: Arithmetic expressions are not currently allowed. Default template arguments now work and do not have to be given to %template. 04/18/2002: beazley (Paris) Change in internal template handling. Template parameters are now fully integrated into the type system and are aware of typedefs, etc. This builds upon the change below. *** DEVELOPER WARNING *** Word of caution to language module writers. The "name" parameter of certain parse tree nodes (classes, functions, etc.) may be parameterized with types. This parameterization is done using SWIG type-strings and not the underlying C version. For example, int max(int *,int *) has a name of "max<(p.int)>". If you use the name directly, you may get syntax errors in the generated code. To fix this, use SwigType_namestr(name) to convert a parameterized name to a C name with valid syntax. The internal version is used to reduce template types to a common representation and to handle issues of typedef. 04/16/2002: beazley (somewhere over the Atlantic) Enhancement of typedef resolution. The type system is now aware of template arguments and typedef. For example: typedef int Integer; foo(vector *x, vector *y); In this case, vector and vector are the same type. There is some interaction between this mechanism and the implementation of typemaps. For example, a typemap defined for vector * would apply to either type. However, a typemap for vector * would only apply to that type. Typedefs and typemaps and matched by left-most expansion. For example: vector --> vector --> vector 04/24/2002: cheetah (William Fulton) [Java] Changes to Java shadow classes. Overcomes a bug where the module assumed that a pointer to a derived class could be used in place of a pointer to a base class. Thanks to Stephen McCaul for analysing the bug and submitting patches. A consequence is that the getCPtr() method in each shadow class has disappeared and has been replaced with a getCPtrXXX(), where XXX is the shadow class name. If you have code that previously used getCPtr(), and the associated class is wrapping a C struct or a C++ class that is not involved in an inheritance chain, just use the new method. If however, the class is involved in an inheritance chain, you'll have to choose which pointer you really want. Backwards compatibility has been broken as not using the correct pointer can lead to weird bugs through ill-defined behaviour. If you are sure you want the old methods, you could add them back into all shadow classes by adding this at the beginning of your interface file: %pragma(java) allshadowcode=%{ public long getCPtr(){ return swigCPtr; } %} Please see entry dated 07/23/2002 to see how to do this after the deprecation of the allshadowcode pragma. *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE *** 04/13/2002: beazley Fixed problem with default arguments and references. Declarations such as this should now work: void foo(const string &x = "Hello"); 04/12/2002: beazley Added typemap $* substitutions for typemaps involving arrays. Requested by William Fulton. 04/11/2002: beazley Template specialization is now supported. For example: template<> class vector { ... }; When the %template directive is used, it will use a specialization if one is defined. There are still some limitations. Partial specialization is not supported. A template of type does not match all pointers. *** NEW FEATURE *** 04/11/2002: beazley Major change to template wrapping internals. Template declarations are no longer processed as macros but now result in real parse-tree nodes. The %template directive expands these nodes into a specific instantiation. This change enables a number of new and interesting capabilities: Directives such as %rename, %feature, and %addmethods can now be applied to uninstantiated templates. For example: %rename(barsize) vector::bar(char *buf, int len); ... template class vector { public: ... void bar(char *buf); void bar(char *buf, int len); // Renamed ... }; %template(intvector) vector; // Renaming carries through By parsing templates into an internal data structure, it will be possible to support specialization (and maybe partial specialization). This is highly experimental and a work in progress. *** POTENTIAL INCOMPATIBILITY *** In SWIG-1.3.11, template declarations were simply processed as weird macros. No other information was retained. This made it impossible to support more advanced features and complicated many other parts of the implementation. 04/09/2002: beazley Change to template class wrapping. There were a variety of "issues" with the old approach related to parsing, the type system, and namespaces. These changes are meant to rectify some of these problems: A specific instantiation of a template can now be specified by including the class inline like this: class vector { public: vector(); ~vector(); ... whatever ... }; This is template specialization, but partial specialization is not yet implemented. The %template directive has been modified to expand roughly as follows: %template(vecint) vector; becomes %rename(vecint> vector; class vector { public: vector(); ... }; Note that this simply builds upon the code above (templates included inline). This modified approach to wrapping fixes some subtle type issues. For instance, you can now define typemaps and typedefs like this: %typemap(in) vector * { ... } typedef vector intvector; ... void blah(intvector *v); // Gets the above typemap This did not work in SWIG-1.3.11 due to a peculiarity of the template implementation. %template(name) no longer installs the template as a class with name "name". This might break %addmethods as described in the manual. For example: %template(vecint) vector; %addmethods vecint { // Fails. vecint not a class ... }; To fix this, just use the template name instead: %addmethods vector { ... } Note: This technique might be a way to implement some bizarre template specialization techniques. For example: %addmethods vector { // Only applied if vector instantiated later %typemap(in) vector * { ... } ... }; *** POTENTIAL INCOMPATIBILITY *** 04/08/2002: beazley Fixed [ 540868 ] #if defined whatever - not parsed. SWIG should now correctly handle preprocessor directives like this: #if defined __cplusplus ... #endif Note: was implemented previously, but there was a minor bug. Reported by Adam Hupp. 04/07/2002: beazley %readonly and %readwrite are deprecated due to a change in the implementation. Instead of being pragmas, mutability is now controlled as a "feature" using the following two directives: %immutable; int x; // read-only variable int y; // read-only variable %mutable; int z; // Modifiable %immutable and %mutable are much more powerful than their older counterparts. They can now pinpoint a specific declaration like this: %immutable x; /* Any x */ %immutable Foo::x; /* x in class Foo */ In fact, the matching algorithm is the same as for %rename, %ignore, and other directives. This means that the declaration %immutable Foo::x; would not only apply to class Foo but to all derived classes as well. *** POTENTIAL INCOMPATIBILITY *** %immutable and %mutable must be terminated by a semi-colon. This differs slightly from the older %readonly and %readwrite directives. Since %immutable and %mutable can be applied to declarations the semicolon is needed to distinguish between a global feature and one targeted to a single declaration. Note: this incompatibility is the primary reason for changing the name of the directive. 04/07/2002: beazley New handling of copy constructors. If a class defines constructors like this: class Foo { public: Foo(); Foo(const Foo &); // Copy constructor ... }; SWIG now generates a function copy_Foo() for the copy constructor. In previous verions, this generated a name-clash and an error message. To preserve backwards compatibility, SWIG does not change the behavior if %rename is used to resolve the name conflict. However, if no name resolution is made, this new approach is used. Copy constructors may be handled as a special case in the target language. However, this is up to the language module itself. 04/07/2002: beazley The %template directive is now namespace aware. This allows code like this: namespace foo { template max(T a, T b) { return a > b ? a : b; } } using namespace foo; %template(maxint) max; // Ok namespace bar { using foo::max; %template(maxdouble) max; // Ok } Caveat: the template name supplied to %template must be defined in the same scope in which the %template directive appears. This code is illegal: %template(maxint) foo::max; 04/07/2002: beazley Minor enhancement to preprocessor. The preprocessor can now perform string comparison. For example: #define A "hello" ... #if A == "hello" ... #endif The primary use of this is in SWIG macros. For example: %define FOO(x) #if #x == "int" /* Special handling for int */ ... #endif %enddef Normal users can probably safely ignore this feature. However, it may be used in parts of the SWIG library. 04/07/2002: beazley Further refinement of default constructor/destructor wrapper generation. SWIG is now much more aware of pure virtual methods. For instance: class A { /* Abstract */ public: virtual void method1() = 0; virtual void method2() = 0; }; class B : public A { /* Abstract */ public: virtual void method1() { }; }; class C : public B { /* Ok */ public: virtual void method2() { }; }; In this case, SWIG will only generate default constructors for C. Even though B looks fine, it's missing a required method and is abstract. 04/04/2002: beazley Subtle change to structure data member access. If you have a structure like this: struct Foo { Bar b; }; The accessor functions for b are generated as follows: (1) If b is *not* defined as a structure or class: Bar Foo_b_get(Foo *self) { return self->b; } void Foo_b_set(Foo *self, Bar value) { self->b = value; } (2) If b *is* defined as a structure or class: Bar *Foo_b_get(Foo *self) { return &self->b; } void Foo_b_set(Foo *self, Bar *value) { self->b = *value; } See the "Structure data members" section of Doc/Manual/SWIG.html for further details. *** POTENTIAL INCOMPATIBILITY *** This may break interfaces that relied on a lot of a undeclared structure and class names. To get the old behavior, simply use a forward declaration such as "struct Bar;" 04/04/2002: beazley C++ namespace support added. SWIG supports all aspects of namespaces including namespace, using, and namespace alias declarations. The default behavior of SWIG is to flatten namespaces in the target language. However, namespaces are fully supported at the C++ level and in the type system. See Doc/Manual/SWIGPlus.html for details on the implementation. 04/02/2002: cheetah (William Fulton) [Java] Sun has modified javac in jdk1.4 to no longer compile an import of an unnamed namespace. To fix this SWIG no longer generates the import for packageless classes. http://developer.java.sun.com/developer/bugParade/bugs/4361575.html As reported SF #538415. 03/27/2002: ljohnson (Lyle Johnson) [Ruby] Added support for pointer-to-member, similar to that for the Python module. Remarkably similar. Also added a new example for this (Examples/ruby/mpointer), which is remarkably similar to the Python example of the same name. 03/26/2002: ljohnson (Lyle Johnson) [Ruby] Made a few minor edits to the "Advanced Topics" chapter of the SWIG manual and added a new major section about how to create multi-module Ruby packages with SWIG. 03/26/2002: ljohnson (Lyle Johnson) [Ruby] Removed all of the old Ruby pragmas. If any of this functionality is truly missed we can resurrect it, preferably with some kind of feature-based directive. 03/25/2002: ljohnson (Lyle Johnson) [Ruby] Fixed SWIG exception library support for Ruby, which has apparently been broken for some time. Luckily, no one seems to have noticed. 03/23/2002: beazley C++-namespace support in SWIG directives. %addmethods: The %addmethods directive now accepts a fully qualified classname and can be used inside C++ namespace declarations. For example: // Attaches to the class Foo::Bar below %addmethods Foo::Bar { int somemethod() { ... } }; namespace Foo { class Bar { public: ... }; // Attaches to the class Bar above %addmethods Bar { int othermethod() { ... }; } } %feature, %rename, %ignore, %exception, and related directives: Namespaces are fully integrated into the renaming and declaration matcher. For example: %rename(display) Foo::print; // Rename in namespace Foo %ignore Foo::Bar::blah; // Ignore a declaration %rename directives can be placed inside namespace blocks as well. For example: namespace Foo { %rename(display) print; // Applies to print below void print(); }; Most other SWIG directives should work properly inside namespaces. No other changes are needed. 03/22/2002: beazley Some changes to internal symbol table handling. SWIG no longer manages structures and unions in a separate namespace than normal declarations like ANSI C. This means you can't have a structure with the same name as a function. For example: struct Foo { ... } int Foo() { ... } This approach is more like C++. It's not clear that SWIG ever really supported the ANSI C anyways---using the same name would almost certainly generate a name-clash in the target language. 03/22/2002: ljohnson (Lyle Johnson) [Ruby] Fixed [ 517302 ] for handling of renamed overloaded constructors. Now, renamed overloaded constructors are converted into class singleton methods (basically acting as "factory" methods). 03/21/2002: beazley Fixed [ 532957 ] %ignore parse error and casting operator. Reported by William Fulton. 03/18/2002: beazley (** ADVANCED USERS ONLY **) Added support for dynamic casting in return values. A somewhat common problem in certain C++ programs is functions that hide the identity of underlying objects when they are returned from methods and functions. For example, a program might include some generic method like this: Node *getNode(); However, Node * may just be base class to a whole hierarchy of different objects. Instead of returning this generic Node *, it might be nice to automatically downcast the object into the appropriate type using some kind dynamic cast. Assuming you understand the peril involved, a downcast can now be performed using the following function in the run-time type checker: swig_type_info *SWIG_TypeDynamicCast(swig_type_info *, void **ptr); This function checks to see if the type can be converted to another type. If so, a different type descriptor (for the converted type) is returned. This type descriptor would then be used to create a pointer in the target language. To use this, you would write a typemap similar to this: %typemap(out) Node * { swig_type_info *ty = SWIG_TypeDynamicCast($1_descriptor, (void **) &$1); $result = SWIG_NewPointerObj($1, ty); } Alternatively, %typemap(out) Node * = SWIGTYPE *DYNAMIC; To make the typemap have any effect, you have to write a supporting function that knows how to perform downcasting. For example: %{ static swig_type_info * Node_dynamic_cast(void **ptr) { Node **nptr = (Node **) ptr; Element *e = dynamic_cast(*nptr); if (e) { *ptr = (void *) e; return SWIGTYPE_p_Element; } Data *d = dynamic_cast(*nptr); if (d) { *ptr = (void *) d; return SWIGTYPE_p_Data; } return 0; } %} There is no restriction on how types are determined. dynamic_cast<> uses C++ RTTI. However, if you had some other mechanism for determining the type, you could use that here. Note: it is important to save the new pointer value back into the argument as shown. When downcasting, the value of the pointer could change. Finally, to make the casting function available, you have to register it with the run-time type checker. Put this macro in your interface file. DYNAMIC_CAST(SWIGTYPE_p_Node, Node_dynamic_cast); Note: this feature does not introduce a performance penalty on normal SWIG operation. The feature is only enabled by writing a new typemap that explicitly calls SWIG_TypeDynamicCast() to make a conversion. Examples/test-suite/dynamic_cast.i contains a simple example. This feature is not supported in the Java module due to differences in the type-checking implementation. *** EXPERIMENTAL FEATURE *** 03/17/2002: beazley Small change to type-name handling of unnamed structures and typedef. If a structure of this form appears: typedef struct { ... } Foo; Then 'Foo' is used as the proper typename for the structure. Furthermore, Foo can now be used as a name in C++ inheritance. SWIG was already kind of doing this, but this modification refines the implementation to more closely follow the C++ ARM, section 7.1.3, p. 106. This fixes a couple of obscure corner cases. 03/16/2002: beazley Modified C++ inheritance with a few enhancements. First, type information needed for casting and type-equivalence is generated even when base-classes aren't defined in the interface. For example: class Foo : public Bar { /* Bar unspecified */ public: ... }; void blah(Bar *b); In this case, the blah() function still accepts Foo * even though nothing is really known about Bar. Previous SWIG versions would just generate a type error. Inheritance has also been modified to work through typedef. For example: class Bar { }; typedef Bar OtherBar; class Foo: public OtherBar { } In this case, the base class of OtherBar is correctly resolved back to Bar. The use of the name OtherBar is lost in this resolution (the wrappers will simply use Bar instead of the typedef name OtherBar). 03/13/2002: beazley %typemap, %apply, and related directives can now appear inside class definitions. 03/13/2002: beazley Fixed a variety of problems related to compiling SWIG on 64-bit platforms. 03/12/2002: beazley Fixed problem with "ignore" and "in" typemaps. Local variables associated with "in" were being added to the wrapper function even though they were never used. Mostly harmless, but it would lead to a variety of compilation warnings. 03/12/2002: beazley Some changes to the internal type system and handling of nested C++ types. In previous versions of SWIG, if you had the following: class Foo { public: typedef int Blah; }; class Bar : public Foo { public: void somemethod(Blah x); }; The argument type in somemethod() would implicitly be set to Bar::Blah. Although this is technically allowed, it breaks typemaps. For example: %typemap(in) Foo::Blah { ... } doesn't match like you expect. This has been changed in SWIG-1.3.12. Now, types are expanded using the class in which they were defined. So, the argument type in somemethod() will be Foo::Blah---since the type Blah was defined in Foo. 03/10/2002: beazley Fixed some subtle type scoping problems with typedef and C++ classes. For example: typedef int Blah; class Bar { public: typedef double Blah; void foo(Blah x, ::Blah y); ... } 03/10/2002: beazley Highly experimental change to handle variable length arguments. First, there is no portable or reliable way to wrap a varargs function in full generality. However, you *can* change the function signature using %varargs. %varargs(char *) fprintf; ... void fprintf(FILE *f, char *fmt, ...); In this case, the variable length parameter "..." is simply replaced by the parameters given in %varargs. This results in a function like this: void fprintf(FILE *f, char *fmt, char *s); More than one argument can be used and default values can be defined. For example, this code specifies a maximum of four arguments. %varargs(char *x1 = 0, char *x2 = 0, char *x3 = 0, char *x4 = 0) fprintf; *** EXPERIMENTAL NEW FEATURE *** 03/10/2002: beazley Change to handling of variable length arguments. varargs is now handled as a proper parameter and is passed to the code generator. However, it still can't be handled correctly (and will generate a typemap warning). This change has been made to better incorporate variable length arguments with other directives such as %ignore, %rename, %feature, and so forth. 03/10/2002: beazley Fixed [ 522555 ] Syntax error parsing "define" construct. SWIG is a little more restrictive in determining #define statements that will be wrapped as constants. Also added a better parser error rule for handling bad constants. 03/08/2002: cheetah (William Fulton) [Java] Bug fix: Classes renamed with %rename that are derived from another class generate more appropriate shadow class code. 03/08/2002: cheetah (William Fulton) [Java] Fixed SF [ #523632 ] and [ #513335 ] both reported by Israel Tanner. Support for types that are used which are in a typedef. The appropriate shadow class name is generated. Also generated correct shadow classname when a templated class is used within another templated class. See the cpp_typedef.i testcase. 03/08/2002: cheetah (William Fulton) [Java] Bug fix: No type was generated in shadow classes for types that weren't wrapped by SWIG. The type is treated as a raw pointer, ie no shadow class. 02/22/2002: beazley Refined the matching algorithm used by %rename, %ignore, and %feature. If a type signature is supplied, it must exactly match that used in the declaration---including any use of const. For example: %rename(foo1) foo(int); %rename(bar1) bar(int) const; class Blah { public: void foo(int); // Matched --> foo1 void foo(int) const; // Not matched void bar(int); // Not matched void bar(int) const; // Matched --> bar1 } In previous versions, a non-const specification would match both the non-const and const declarations. However, the whole point of %rename and related directives is that they be able to precisely pinpoint exact declarations in an interface. This fixes the problem. 02/21/2002: beazley Reworked the handling of default constructor and destructors. SWIG now makes a preliminary pass over the parse tree to discover which classes support default allocation. This fixes a number of very subtle issues in code generation and call/return by value. 02/18/2002: cheetah (William Fulton) Improved support on Cygwin: Perl, Python, Tcl, Ruby and Java should work out of the box, barring the runtime library. Removed dllwrap and replaced with newly working gcc -shared instead for Cygwin. All this will require the new improved binutils 20010802 and later, but the latest Cygwin is usually the best recommendation. 02/15/2002: beazley Fixed some problems related to wrapping of global variables and Perl shadow classes. Reported by Chia-liang Kao. 02/15/2002: ljohnson (Lyle Johnson) [Ruby] Made a fix to the code generation for C++ class constructors so that we get both a "new" singleton method and an "initialize" instance method for each class. This change enables developers to derive new Ruby classes from SWIG-wrapped C++ classes and then override their initialize methods to provide subclass-specific instance initialization. 02/15/2002: ljohnson (Lyle Johnson) [Ruby] Massive documentation update for the Ruby module, contributed by Craig Files. 02/14/2002: ljohnson (Lyle Johnson) [Ruby] Bug fix: An error in the SWIG runtime support for Ruby was causing several of the examples to fail. Reported by William Fulton. 02/14/2002: ljohnson (Lyle Johnson) [Ruby] Bug fix: Enumerations defined within a class (such as those seen in the Examples/ruby/enum example) were not being exported with the correct names. Reported by William Fulton. 02/13/2002: ljohnson (Lyle Johnson) [Ruby] Added a warning message when we run across overloaded class constructors for C++ code, that this is currently not supported (even if the overloads have been %renamed). For an example of where this doesn't work, see Examples/ruby/operator. 02/13/2002: ljohnson (Lyle Johnson) [Ruby] Added an "ignored" warning message when the parser runs across an operator!=() declaration for C++ code. 02/11/2002: ljohnson (Lyle Johnson) [Ruby] Added the "import", "import_template", "operator" and "template" examples. 02/11/2002: ljohnson (Lyle Johnson) [Ruby] Added multi-module support. 02/09/2002: ljohnson (Lyle Johnson) [Ruby] Added the missing "#define SWIG_NOINCLUDE" at the top of the wrapper code when the '-c' option is used. 02/09/2002: ljohnson (Lyle Johnson) Corrected a minor off-by-one error for the size of the swig_types[] array that's generated in the wrapper code. 02/08/2002: beazley Fixed SF [ #515058 ] Wrong code for C++ templates. Reported by Israel Taller. Version 1.3.11 (January 31, 2002) ================================= 01/30/2002: beazley Fix to pass/return by value for C++ objects that define no default constructor. Changes to the typemap system made it impossible to wrap C++ objects with no default constructor. This has been fixed, but the solution involves some clever template magic contributed by William Fulton. Please see the comments in the file Lib/swig.swg for further details. This solution is experimental and may be refined in a future release. 01/30/2002: beazley Global variables and member data of type "const char *" can be set, but the old value is silently discarded without any garbage collection. This may generate a memory leak. This change is needed to more safely handle variables like this: const char *foo = "Hello World\n"; In this case, it's not safe to free the old value. However, SWIG can dynamically allocate a new value and make foo point to it. To fix this memory leak, you can probably do this: %clear const char *foo; %apply char * {const char *foo}; *** POTENTIAL INCOMPATIBILITY *** 01/30/2002: beazley Two minor typemap enhancements have been added. First, typemaps can issue a warning message by including a special warning attribute. For example: %typemap(in,warning="I'm going to do something dangerous") ... The warning message will show up whenever the typemap is applied. Second, a typemap can force a no-match by defining %typemap(in) sometype "pass"; If this is used, the typemap system will *not* record a typemap match for "sometype". This can be used to block selected typemaps. For example, if you wanted to disable a typemap feature for some type, you could do this. // Do not allow global variables of type 'const char *' to be set. %typemap(varin) const char * "pass"; It might also be possible to use this to do subtle and strange things with typemaps. For example, if you wanted to make 'blah *' an output value and 'const blah *' an input parameter, you might do this: %typemap(ignore) blah *(blah temp) { $1 = &temp; } %typemap(argout) blah * { ... return a value ... } /* Block unqualified typemaps defined above */ %typemap(ignore) const blah * "pass"; %typemap(argout) const blah * "pass"; %typemap(in) const blah * { ... get input value ... } (This potential applications of typemaps suggested by Greg Stein). *** NEW FEATURE *** 01/29/2002: cheetah (william fulton) [Java] Bug fix: No enumerations were wrapped when the -shadow commandline option was not specified. Reported by Israel Taller. 01/28/2002: cheetah (william fulton) [Java] Global arrays are successfully wrapped. In fact they started mostly working in SWIG-1.3.10. 01/28/2002:richardp Added first attempt at C++ and -shadow support for PHP4 module, please test and mail me if any problems/ideas on improving it. There is a known problem with uninitialized member variables, please see Examples/php4/sync/README for details. Also more PHP documentation added to Doc/Manual/Php.html 01/27/2002:beazley The ANSI C size_t type is now recognized as an integer by default. 01/26/2002:beazley long long and unsigned long long support added to many language modules. This is not a portable feature and will require compiler support for the long long type. In target languages that do not support long long (e.g., Tcl and Perl), numbers are converted to a string of digits. This prevents their use in arithmetic calculations, but still allows values to be set from a string. long long support requires the use of the strtoll() and strtoull() functions as well as the 'lld' and 'llu' format specifiers of sprintf(). 01/26/2002:beazley Fixed [ #501827 ] Delete method is not called. The Tcl module wasn't correctly calling destructors when they were defined using %addmethods. This has been fixed. Reported by Reinhard Fobbe. 01/26/2002: beazley Better support for long long and unsigned long long. Typemaps have been included in a number of modules for handling these types. In addition, the parser has been modified to accept long long literals such as 1234LL and 1234ULL. 01/27/2002: cheetah (william fulton) [Java] A C char[] is mapped to a Java String which is the default SWIG handling of char[] and char*. It used to be mapped to byte[]. Note that a C signed char[] array is mapped to byte[]. *** POTENTIAL INCOMPATIBILITY *** 01/25/2002: beazley Fixed a problem with return-by-value, C++, and objects that define no default constructor. Reported by Joel Reed. 01/25/2002: cheetah (william fulton) [Java] Overhaul of the Java module. The C code generation is now done from typemaps. 01/24/2002: cheetah (william fulton) [Java] Support for arrays of enum pointers 01/20/2002: cheetah (william fulton) [Java] Error checking for null Java objects being passed to native functions. Exception thrown now whereas before the JVM crashed. 01/18/2002: cheetah (william fulton) [Java] Corrected behaviour for functions that take arrays. For example, when this c function: void arrayfn(int array[]); is wrapped the corresponding native function public final static native void arrayfn(int[] array); is produced. Previously if the C function made any changes to the array elements, these were not reflected back into the Java array. This has now been corrected so that the changes are propogated back to Java and the calling function will see these changes. This is how pure Java functions work, ie arrays are passed by reference. 01/15/2002:mkoeppe [Guile] New file cplusplus.i with C++ typemaps contributed by Marcio Luis Teixeira . 01/11/2002: cheetah (william fulton) [Java] Changed mapping of C long to Java type. Was mapped to Java long, now mapped to Java int. If you want the previous mapping to Java long use this approach in your interface file: %clear long; %typemap(jni) long "jlong" %typemap(jtype) long "long" %typemap(jstype) long "long" %clear long[ANY]; %typemap(jni) long[ANY] "jlongArray" %typemap(jtype) long[ANY] "long[]" %typemap(jstype) long[ANY] "long[]" %typemap(in) long[ANY] {write me for array support} %typemap(out) long[ANY] {write me for array support} %typemap(argout) long[ANY] {write me for array support} %typemap(freearg) long[ANY] {write me for array support} *** POTENTIAL INCOMPATIBILITY *** This new mapping is more appropriate when interfacing to 32 bit applications which are used in the current 32-bit JVMs. For future 64-bit JVMs you may have to change these mappings - eg on Unix LP64 systems, but not on Microsoft 64bit Windows which will be using a P64 IL32 model. This may be automated in a future version of SWIG. 01/10/2002:beazley Fixed [ 501677 ] %init block in wrong place. Reported by Luigi Ballabio. 01/09/2002: cheetah (william fulton) [Java] Default support for the long long type. signed long long is mapped to a Java long. unsigned long long is mapped to BigInteger. 01/09/2002:beazley Experimental change to parser to better support mixing of int, long, short, unsigned, float, and double. The parser should now support types like this: short unsigned int int unsigned short unsigned short int unsigned int short This change also enables a type of 'long double' (previously unsupported) to be used. *** NEW FEATURE *** 01/05/2002: cheetah (william fulton) [Java] Casting fix for when function return type is a pointer as reported by Gary Pennington 2002-01-05. The upper 32bits of the 64 bit jlong will have contained junk for 32bit pointers. 01/05/2002: cheetah (william fulton) [Java] Better pointer handling in Java is possible as the INPUT, OUTPUT and INOUT typemaps have been added into typemaps.i. 01/05/2002: cheetah (william fulton) [Java] $null can be used in input typemaps to return early from JNI functions that have either void or a non-void return type. Example: %typemap(check) int * %{ if (error) { SWIG_exception(SWIG_IndexError, "Array element error"); return $null; } %} If the typemap gets put into a function with void as return, $null will expand to nothing: void jni_fn(...) { if (error) { SWIG_exception(SWIG_IndexError, "Array element error"); return ; } ... } otherwise $null expands to zero, where javareturntype is either a pointer or a primitive type: javareturntype jni_fn(...) { if (error) { SWIG_exception(SWIG_IndexError, "Array element error"); return 0; } ... } 01/02/2002: cheetah (william fulton) [Java] The Java module incorrectly used argout typemaps for strings. This is now corrected and the code now resides in the freearg typemap. The argout array typemaps have been split into argout and freearg typemaps. This correction may require some user written typemaps to be modified. *** POTENTIAL INCOMPATIBILITY *** 12/28/2001: cheetah (william fulton) [Java] Multi typemaps now working for Java see multimap example. [Java] Fix for recently introduced bug - freearg typemap code was appearing before the function call. 12/28/2001: cheetah (william fulton) [Java] JCALL macro for JNI calls that work in both C and C++ typemaps have been replaced with JCALL0, JCALL1, JCALL2, JCALL3 and JCALL4 macros. *** POTENTIAL INCOMPATIBILITY *** 12/22/2001:beazley Resolved some inconsistent behavior with %rename and class renaming. If you specify the following: %rename(Foo) Bar; class Bar { public: Bar(); ~Bar(); } Then the %rename directive applies to the class itself, the constructor, and the destructor (all will be renamed to Foo). If a class defines more than one constructor, the overloaded variants can still be renamed by specifying parameters to %rename. For example: %rename(Bar_copy) Bar(Bar &); class Bar { public: Bar(); Bar(Bar &); ~Bar(); }; There are still some odd corner cases. If you specify %rename(Foo) ::Bar; then only the name of the class is changed and the constructor/destructor names are left unmodified. If you specify %rename(Foo) *::Bar; then the names of the constructor/destructor functions are modified but the name of the class is not. 12/21/2001: cheetah (william fulton) [Java] jni, jtype and jstype typemaps no longer hardcoded but real typemaps. New variable substitution, $javaclassname, can be used in the jstype typemaps. It is replaced with the Java shadow class name where applicable. [Java] Fix for recently introduced bug to do with inheritance when using %import. [Java] A few more bug fixes, todo with %rename and using the kind with the type, eg void fn(union uni myuni, struct str mystr, class cl mycl); 12/20/2001:beazley Fixed [ #494524 ] Preprocessor bug - apostrophe and #subst. 12/20/2001:beazley Added SWIG_VERSION preprocessor symbol. This is a hexadecimal integer such as 0x010311 (corresponding to SWIG-1.3.11). This can be used in the interface as follows: #if SWIG_VERSION >= 0x010311 /* Use some fancy new feature */ #endif Note: The version symbol is not defined in the generated SWIG wrapper file. *** NEW FEATURE *** 12/20/2001:mkoeppe [MzScheme]: Renamed mzswig_make_boolean to swig_make_boolean, as the latter is used in the typemaps. Reported by Luigi Ballabio. 12/17/2001:mkoeppe [Guile]: Rewrote list-vector.i using multi-dispatch typemaps. Updated pointer-in-out.i. Make the deprecated typemap-substitution of "$source" in "argout" work as before. 12/16/2001:mkoeppe [Guile]: Fixed macros %values_as_list, %values_as_vector, %multiple_values to use the proper %pragma syntax. New Guile example/test "multivalue"; new Guile run-test for test-suite item "list-vector" (currently broken). 12/14/2001:mkoeppe [Guile]: Fixed typemap-substition bug for "varin". Relaxed valid-identifier check to allow all R5RS identifiers. Version 1.3.10 (December 10, 2001) ================================== 12/08/2001:beazley Modified %typemap so that %{ ... %} can also be used as a code block (mostly for completeness). For example: %typemap(in) blah %{ ... %} This form does not introduce a new block scope. Also, the code enclosed in %{ ... %} is not processed by the preprocessor. 12/08/2001:beazley Fixed [ #459614 ] SWIG with multiple TCL interpreters. 12/08/2001:beazley Fixed [ #417141 ] rubydec.swg is wrong Reported by Paul Brannan. 12/08/2001:beazley Fixed [ #410557 ] Problem with %addmethods on NT. Reported by Magnus Ljung. 12/08/2001:beazley Fixed [ #445233 ] Enhancement: handle access change. SWIG now parses (but ignores) C++ access changes for the the following: class A { protected: void something() { } public: A() {} }; class B : private A { public: B() : A() { } protected: A::something; <---- Parsed, but ignored }; Suggested by Krzysztof Kozminski. 12/08/2001: cheetah (william fulton) Fix for Ruby to work using Visual C++. 12/06/2001:beazley Fixed [ #465687 ] unsigned short parameters fail. Reported by Gerald Williams. 12/06/2001:beazley Fixed SF [ #489594 ] PyString_FromString can't take NULL arg. Reported by John Merritt. SWIG now converts string values to Python using code like this: resultobj = result ? PyString_FromString(result) : Py_BuildValue(""); 12/06/2001:beazley Fixed SF [ #463561 ] Type conversions not generated. Reported by Gerald Williams. 12/04/2001:beazley Fixed SF [ #470217 ] Tcl default argument handling. Reported by Shaun Lowry. 12/04/2001:beazley Fixed SF [ #472088 ] defined(MACRO) expanded everywhere. Embedded preprocessor directives such as %#if defined(FOO) are not expanded by the SWIG preprocessor. Reported by Gerald Williams. 12/04/2001:beazley Fixed SF [ #476467 ] Problems with #define & commas. 12/04/2001:beazley Fixed SF [ #477547 ] wrong declaration of pointer functions. Bad prototypes in Lib/tcl/ptrlang.i. 12/04/2001:beazley Fixed SF [ #483182 ] Constants can take args by mistake. When swig -perl5 -const is used, constants are declared with a void prototype. For example: sub ICONST () { $examplec::ICONST } Patch submitted by Rich Wales. 12/03/2001:beazley New %exception directive. This is intended to replace %except. It works in exactly the same manner except it does not accept a language specifier. For example: %exception { try { $action } catch(SomeError) { error } } %exception is also name aware---allowing it to be applied to specific declarations in an interface. For example: %exception foo { ... exception for any function/method foo ... } %exception Foo::bar { ... exception for method bar in class Foo ... } %exception Foo::bar(double) { ... exception for method bar(double) in class Foo ... } The semantics of this name matching is exactly the same as for %rename. *** NEW FEATURE *** 12/03/2001:beazley Substantial cleanup of the Python shadow class code. Shadow classes used to be created in this rather complicated manner involving about a half-dozen strings created in bits and pieces. Shadow classes are now generated in a more straightforward manner--in the same order that appears in the interface file. *** POTENTIAL INCOMPATIBILITY *** The order in which declarations appear in the shadow file may differ. 12/03/2001:beazley The %insert directive (%{ ... %}, %runtime, %header, %wrapper, etc.) can now be used inside of a class definition. This has potential uses when generating shadow class code. For example: class Foo { ... %insert("shadow") %{ # Some python code def blah(self): print "I'm blah!" %} ... }; The support for class code insertion depends on the language module. However, the intent of this feature is to simplify the task of extending shadow class code. In the Python module, this inserts code with the proper level of indendation (regardless of what was used in the SWIG interface). *** NEW FEATURE *** 11/29/2001: cheetah (william fulton) Modifications for Java and Python modules to work on cygwin. Unfortunately a lot of the python module has started to produces code which cannot be auto-imported using cygwin libtools so most of it is still broken. 11/28/2001:beazley The %rename and %feature directive can now be used inside of a class definition. For example: class Foo { %rename(foo_i) foo(int); %rename(foo_d) foo(double); public: ... void foo(int); void foo(double); ... }; When used in this manner, the %rename directive only applies to members of the class in which it appears as well as all derived classes. In fact, this is really just the same as saying: %rename(foo_i) Foo::foo(int); %rename(foo_d) Foo::foo(double); class Foo { ... }; *** NEW FEATURE *** 11/26/2001:beazley Added the experimental %feature directive. %feature can be used to attach arbitrary string attributes to parse tree nodes. For example: %feature("except") blah { try { $function } catch (Error) { whatever; } } or %feature("set") *::x_set "x"; or %feature("blah") Foo::bar(int,double) const "spam"; The syntax is borrowed from the %rename directive. In fact, the exact same semantics apply (inheritance, matching, etc.). %feature is a very powerful low-level primitive that can be used to customize individual language modules and to provide hints to any stage of code generation. Features are attached to parse tree nodes as attributes with names like "feature:*" where * is replaced by the feature name (e.g., "feature:except", "feature:set", etc.). Language modules can then look for the features using a simple attribute lookup. %feature is intended to be a replacement for a number of older SWIG directives including %except and specialized pragmas. It is more powerful (due to its parameterized name matching) and it provides very precise control over how customization features are attached to individual declarations. There are future expansion plans that will build upon this capability as well. It's not certain that %feature will ever be used directly by SWIG users. Instead, it may be a low-level primitive that is used in high-level macro definitions. For instance, to support properties, you might define a macro like this: %define %property(name, setf, getf) %feature("set") setf #name; %feature("get") getf #name; %enddef Which allows a user to specify things like this: %property(p, get_p, set_p); class Blah { public: int get_p(); void set_p(int); }; *** EXPERIMENTAL NEW FEATURE *** 11/24/2001:beazley The Tcl module has been expanded with some new features for managing object ownership. For example: set c [Circle -args 20] $c area # Invoke a method $c -disown # Releases ownership of the object $c -acquire # Acquires ownership of the object If Tcl owns the object, its destructor is invoked when the corresponding object command is deleted in Tcl. To simplify the destruction of objects, the following syntax can be used: $c -delete # Delete an object This is an alternative for the more obscure variant of rename $c {} These features also add functionality at the C API level. The following functions manage ownership from C and can be used in typemaps. SWIG_Acquire(void *ptr); SWIG_Disown(void *ptr); A new function for constructing instances is also available: Tcl_Obj * SWIG_NewInstanceObj(Tcl_Interp *interp, void *ptr, swig_type_info *type, int own); When used in a typemap, this creates a pointer object and an interpreter command that can be used to issue methods and access attributes as shown above. *** NEW FEATURE *** 11/23/2001:beazley All Python-related %pragma operations have been eliminated. Most of these were written for older SWIG versions in order to compensate for limitations in earlier releases. In an effort to reduce the amount of code-clutter and potential for errors, it is easier to simply eliminate the pragmas and to start over (if needed). To be honest, I'm not even sure the pragmas worked in 1.3.9 and recent releases. Note: If you need to insert code into the shadow class file created by SWIG, simply use the %shadow directive like this: %shadow %{ def some_python_code(): print "blah!" %} *** POTENTIAL INCOMPATIBILITY *** 11/22/2001:beazley Sweeping changes to the way in which the Python module handles shadow classes. In early implementations, shadow classes were merely Python wrappers around typed pointer objects. However, some users actually wanted to receive the shadow class object in C. To accommodate this, the dereferencing of the "this" pointer in a shadow class was moved to C as described in CHANGES [8/8/99]. However, the process of returning pointers to Python was still somewhat problematic. Specifically, shadow classes never worked in situations such as these: - Use of any kind of output typemap ('out' or 'argout') - Global variables (broken as far as I can tell). In the past, some users have dealt with this by manually trying to create shadow class objects themselves from C/C++. However, this was difficult because the C wrappers don't really know how to get access to the corresponding Python class. The Python module has now been modified to automatically attach shadow class objects to pointers when they are returned to Python. This process occurs in the function SWIG_NewPointerObj() so the process is completely transparent to users. As a result, shadow classes are now more seamlessly integrated with typemaps and other features of SWIG. This change may introduce a number of incompatibilities. The SWIG_NewPointerObj() now takes an extra parameter "own" to indicate object ownership. This can be used to return a pointer to Python that Python should destroy. In addition, older code that tries to manually construct shadow class objects or which expects bare pointers may break---such pointers may already be encapsulated by a shadow class. *** POTENTIAL INCOMPATIBILITY *** 11/20/2001:beazley Modified the %insert directive to accept single braces { ... }. For example: %insert("header") { ... some code ... } This works exactly like %{ ... %} except that the code in the braces is processed using the preprocessor. This can be useful in certain contexts such as low-level code generation in language modules. *** NEW FEATURE *** 11/20/2001:beazley Command line options are now translated into preprocessor symbols. For example: ./swig -python -shadow -module blah interface.i Creates the symbols: SWIGOPT_PYTHON 1 SWIGOPT_SHADOW 1 SWIGOPT_MODULE blah Modules can look for these symbols to alter their code generation if needed. *** NEW FEATURE *** 11/20/2001:beazley Massive overhaul of the Perl5 module. A lot of code generation is now driven by tables and typemaps. The generated wrapper code also makes use of tables to install constants, variables, and functions instead of inlining a bunch of procedure calls. The separate variable initialization function is gone. Most code generation is controlled via the perl5.swg file in the library. *** POTENTIAL INCOMPATIBILITY *** 11/13/2001:beazley Added parsing support for the C++ typename keyword. Primarily this is added to better support templates. For example: template void blah(C& v) { typename C::iterator i = v.begin(); } Note: typename is supported in the parser in the same way as 'struct' or 'class'. You probably shouldn't use it anywhere except in templates. *** NEW FEATURE *** 11/11/2001:beazley Massive overhaul of the language module API. Most functions now use a common, very simple, API. There are also a number of interesting semantic side-effects of how code is actually generated. Details will be forthcoming in Doc/Manual/Extending.html. *** POTENTIAL INCOMPATIBILITY *** Language modules written for previous versions of SWIG will no longer work, 11/10/2001:beazley Fixed a very subtle bug due to unnamed class wrapping. For example, if you did this typedef struct { int x,y; } gdPoint, *gdPointPtr; void foo(gdPointPtr x); Then the foo function would get a type-error. The problem has to do with internal typedef handling and the fact that the typedef declarations after the struct appear later in the parse tree. It should work now. Problem reported by Vin Jovanovic. 11/09/2001:beazley Subtle change to "out" typemaps (and related variations). The name that is attached to the typemap is now the raw C identifier that appears on a declaration. This changes the behavior of member functions. For example: %typemap(out) int foo { ... } class Blah { public: int foo(); // typemap gets applied } Previous versions never really specified how this was supposed to work. In SWIG1.1, you could probably write a typemap for the wrapper name like this: %typemap(out) int Blah_foo { ... } However, this old behavior is now withdrawn and not supported. Just use the member name without any sort of special prefix. *** POTENTIAL INCOMPATIBILITY *** 11/06/2001:beazley Changes to Tcl module initialization: (1) SWIG now automatically includes the code needed to work with Tcl stubs. Simply compile with -DUSE_TCL_STUBS. (2) SWIG now automatically calls Tcl_PkgProvide to register a package name. The package name is the same as the name specified with the %module directive. The version number is set to "0.0" by default. To change the version number, use swig -pkgversion 1.2 interface.i. *** POTENTIAL INCOMPATIBILITY *** Modules that provided stubs and Tcl_PkgProvide on their own might break. Simply remove that code. 11/05/2001:beazley Changed code generation of constants in the Tcl module. Constants are now stored in a large table that get installed at module startup. There are also no longer any static variables so it should generate somewhat less code. 11/04/2001:beazley The "const" typemap has been renamed to "constant" in many language modules. "const" is a C keyword which made the handling of the typemap directive somewhat awkward in the parser. *** POTENTIAL INCOMPATIBILITY *** 11/04/2001:beazley %typemap directive can now accept nearly arbitrary keyword parameters. For example: %typemap(in,parse="i",doc="integer") int "..."; The purpose of the keyword parameters is to supply code generation hints to the target language module. The intepretation of the parameters is language specific. *** NEW FEATURE *** 11/04/2001:beazley Slight semantic change to internal call/return by value handling. In previous versions of SWIG, call-by-value was translated into pointers. For example: double dot_product(Vector a, Vector b); turned into this: double wrap_dot_product(Vector *a, Vector *b) { return dot_product(*a,*b); } This translation was normally performed by the SWIG core, outside of the control of language modules. However, a side effect of this was a lot of bizarre typemap behavior. For example, if you did something like this: %typemap(in) int32 { ... } You would find that int32 was transformed into a pointer everywhere! (needless to say, such behavior is unexpected and quite awkward to deal with). To make matters worse, if a typedef was also used, the pointer behavior suddenly disappeared. To fix this, the pointer transformation is now pushed to the language modules. This produces wrappers that look roughly like this: double wrap_dot_product(Vector *a, Vector *b) { Vector arg1 = *a; Vector arg2 = *b; return dot_product(arg1,arg2); } This change also makes it easy to define typemaps for arbitrary undefined types. For example, you can do this (and it will work regardless what int32 is): %typemap(in) int32 { $1 = (int32) PyInt_AsLong($input); } *** POTENTIAL IMCOMPATIBILITY *** This change may break call/return by value code generation in some language modules. 11/03/2001:beazley Changed the name of the default typemaps to the following: %typemap() SWIGTYPE { ... an object ... } %typemap() SWIGTYPE * { ... a pointer ... } %typemap() SWIGTYPE & { ... a reference ... } %typemap() SWIGTYPE [] { ... an array ... } %typemap() enum SWIGTYPE { ... an enum value ... } %typemap() SWIGTYPE (CLASS::*) { ... pointer to member ... } These types are used as the default for all types that don't match anything else. See CHANGES log entry for 8/27/2000 for the old behavior. The role of these types is also described in Doc/Manual/Typemaps.html *** POTENTIAL INCOMPATIBILITY *** 10/25/2001:beazley Modified Guile and Mzscheme modules to support multi-argument typemaps. 10/25/2001: cheetah (william fulton) [Java] Fix to handle pointers to arrays. 10/24/2001:beazley Defining a typemap rule for enum SWIGENUM can now be used to define default behavior for enum variables. 10/22/2001:beazley Ruby module modified to support multi-argument typemaps. 10/22/2001:beazley The Ruby module can now handle functions with an arbitrary number of arguments. Previous versions were limited to to functions with only 9 or 16 arguments depending on the use of default arguments. Note: from some inspection of the Ruby interpreter source, the new approach might be a little faster as well. 10/18/2001:beazley Fixed a bug with forward class declarations and templates. class Foo ; Bug reported by Irina Kotlova. 10/16/2001:beazley Support for multivalued typemaps added. The typemaps are specified using the syntax below. Within each typemap, variable substitution is handled as follows: %typemap(in) (int argc, char *argv[]) { $arg; // The input object in the target language $1; // C local variable for first argument $2; // C local variable for second argument // These variables refer to either argument $1_type, $1_ltype, $1_basetype, etc... (argc) $2_type, $2_ltype, $2_basetype, etc... (argv[]) // Array dimension of argv $2_dim0 } Basically any variable that was available in normal typemaps is available for either argument by prefacing the variable name by '$n_' where n is the argument position. Notes: (1) Multi-valued typemaps can only be applied to a single object in the target scripting language. For example, you can split a string into a (char *, int) pair or split a list into a (int, char []) pair. It is not possible to map multiple objects to multiple arguments. (2) To maintain compatibility with older SWIG versions, the variables such as $target and $type are preserved and are mapped onto the first argument only. (3) This should not affect compatibility with older code. Multi-valued typemaps are an extension to typemap handling. Single valued typemaps can be specified in the usual way. The old $source and $target variables are officially deprecated. Input variables are referenced through $arg$ and output values are reference through $result$. *** NEW FEATURE *** 10/16/2001:beazley Added parsing support for multivalued typemaps. The syntax is a little funky, but here goes: // Define a multivalued typemap %typemap(in) (int argc, char *argv[]) { ... typemap code ... } // Multivalued typemap with locals %typemap(in) (int argc, char *argv[])(int temp) { ... typemap code ... } // Copy a multivalued typemap %typemap(in) (int argcount, char **argv) = (int argc, char *argv[]); // Apply a multivalued typemap %apply (int argc, char *argv[]) { (int argcount, char **argv) }; Note: this extra parsing support is added for future extension. No language modules currently support multi-valued typemaps. 10/11/2001:beazley Modified the typemap matching code to discard qualifiers when checking for a match. For example, if you have a declaration like this: void blah(const char *x); The typemap checker checks for a match in the following order: const char *x const char * char *x char * If typedef's are involved, qualifier stripping occurs before typedef resolution. So if you had this, typedef char *string; void blah(const string x); typemap checking would be as follows: const string x const string string x string const char *x const char * char *x char * The primary reason for this change is to simplify the implementation of language modules. Without qualifier stripping, one has to write seperate typemaps for all variations of const and volatile (which is a pain). *** POTENTIAL INCOMPATIBILITY *** Typemaps might be applied in places where they weren't before. 10/9/2001: beazley SWIG now generates wrappers that properly disambiguate overloaded methods that only vary in constness. For example: class Foo { ... void blah(); void blah() const; ... }; To handle this, the %rename directive can be used normally. %rename(blah_const) blah() const; In the resulting wrapper code, method calls like this are now generated: (obj)->blah() // Non-const version ((Foo const *)obj)->blah() // const version This should force the right method to be invoked. Admittedly, this is probably obscure, but we might as well get it right. 10/8/2001: beazley The preprocessor now ignores '\r' in the input. This should fix the following bug: [ #468416 ] SWIG thinks macro defs are declarations? 10/8/2001: beazley Added support for ||, &&, and ! in constants. This fixes SF [ #468988 ] Logical ops break preprocessor. However, at this time, constants using these operators are not supported (the parser will issue a warning). 10/4/2001: beazley Added -show_templates command line option. This makes SWIG display the code it actually parses to generate template wrappers. Mostly useful for debugging. *** NEW FEATURE *** 10/4/2001: beazley Change to semantics of %template directive. When using %template, the template arguments are handled as types by default. For example: %template(vecint) vector; %template(vecdouble) vector; To specify a template argument that is *not* a type, you need to use default-value syntax. For example: %template(vecint) vector; %template(vecdouble) vector; In this case, the type name doesn't really matter--only the default value (e.g., 50, 100) is used during expansion. This differs from normal C++, but I couldn't figure out a better way to do it in the parser. Might implement an alternative later. *** POTENTIAL INCOMPATIBILITY *** 10/4/2001: beazley Major changes to template handling in order to provide better integration with the C++ type-system. The main problem is as follows: Suppose you have a template like this: template void blah(const T x) { stuff }; Now suppose, that you instantiate the template on a type like this in SWIG: %template(blahint) blah; In C++, this is *supposed* to generate code like this: void blah(int *const x) { stuff }; However, in SWIG-1.3.9, the template substitution gets it wrong and produces void blah(const int *x) { stuff }; (notice the bad placement of the 'const' qualifier). To fix this, the SWIG parser now generates implicit typedefs for template type arguments that produces code roughly equivalent to doing this: typedef int *__swigtmpl1; %template(blahint) blah<__swigtmpl1>; which generates code like this: void blah(const __swigtmpl1 x) { stuff }; Since this is correct in both C++ and SWIG, it provides the right semantics and allows everything to compile properly. However, to clean up the generated code a little bit, the parser keeps track of the template types and performs back-substitution to the original type when building the parse tree. Thus, even though the implicit typedef is used in the input and may appear in the generated wrapper file (for proper compilation), the parse tree will hide a lot of these details. For example: void blah(const __swigtmpl1 x) { stuff }; will look like it was declared as follows (which is what you want): void blah(int *const x) { stuff } The only place you are likely to notice the typedef hack is in bodies of template functions. For example, if you did this, template class blah { ... %addmethods { void spam() { T tempvalue; ... } } } you will find that 'T tempvalue' got expanded into some strange typedef type. This *still* compiles correctly so it's not a big deal (other than looking kind of ugly in the wrapper file). 10/4/2001: beazley Fixed some inheritance problems in Tcl Object interface. 10/1/2001: beazley Tcl module has changed to use byte-backed pointer strings. This implementation should be safe on 64-bit platforms. However, the order in which digits appear in pointer values no longer directly corresponds to the actual numerical value of a pointer (on little-endian machines, pairs of digits appear in reverse order). 10/1/2001: beazley Perl5 module is now driven by a configuration file 'perl5.swg' in the SWIG library. 10/1/2001: beazley The perl5 module no longer tries to apply the "out" typemap in code generated for magic variables. I'm surprised that this ever worked at all (since all of the code that was there was wrong anyways). Use the "varout" typemap to handle global variables. 10/1/2001: beazley Fixed a bug related to character array members of structures. For example: struct Foo { char name[32]; }; SWIG is normally supposed to return a string, but this was broken in 1.3.9. The reason it was broken was actually due to a subtle new feature of typemaps. When a data member is set to an array like this, the return type of the related accessor function is actually set to an array. This means that you can now write typemaps like this: %typemap(python,out) char [ANY] { $target = PyString_FromStringAndSize($source,$dim0); } This functionality can be used to replace the defunct memberout typemap in a more elegant manner. 9/29/2001: beazley Some further refinement of qualified C++ member functions. For example: class Foo { ... void foo() const; ... }; (i) The SWIG parser was extended slightly to allow 'volatile' and combinations of 'const' and 'volatile' to be used. This is probably rare, but technically legal. Only added for completeness. (ii) For the purposes of overloading, qualified and non-qualified functions are different. Thus, when a class has methods like this: void foo(); void foo() const; Two distinct methods are declared. To deal with this, %rename and similar directives have been extended to recognize const. Thus, one can disambiguate the two functions like this: %rename(fooconst) Foo::foo() const; or simply ignore the const variant like this: %ignore Foo::foo() const; Note: SWIG currently has no way to actually invoke the const member since the 'const' is discarded when generating wrappers for objects. 9/27/2001: beazley New directive. %namewarn can be used to issue warning messages for certain declaration names. The name matching is the same as for the %rename directive. The intent of this directive is to issue warnings for possible namespace conflicts. For example: %namewarn("print is a python keyword") print; The name matching algorithm is performed after a name has been resolved using %rename. Therefore, a declaration like this will not generate a warning: %rename("Print") print; ... void print(); /* No warning generated */ Since the warning mechanism follows %rename semantics, it is also to issue warnings for specific classes or just for certain member function names. (Dave - I've been thinking about adding something like this for quite some time. Just never got around to it) *** NEW FEATURE *** 9/27/2001: beazley Enhanced the %ignore directive so that warning messages can be issued to users. This is done using %ignorewarn like this: %ignorewarn("operator new ignored") operator new; The names and semantics of %ignorewarn is exactly the same as %ignore. The primary purpose of this directive is for module writers who want to ignore certain types of declarations, but who also want to alert users about it. A user might also use this for debugging (since messages will appear whenever an ignored declaration appears). *** NEW FEATURE *** 9/26/2001: beazley Super-experimental support for overloaded operators. This implementation consists of a few different parts. (i) Operator names such as 'operator+' are now allowed as valid declarator names. Thus the 'operator' syntax can appear *anyplace* a normal declarator name was used before. On the surface, this means that operators can be parsed just like normal functions and methods. However, it also means that operator names can be used in many other SWIG directives like %rename. For example: %rename(__add__) Complex::operator+(const Complex &); (ii) Operators are wrapped *exactly* like normal functions and methods. Internally, the operator name is used directly meaning that the wrapper code might contain statements like this: arg0->operator*((Complex const &)*arg1); This all seems to parse and compile correctly (at least on my machine). (iii) SWIG will no longer wrap a declaration if its symbol table name contains illegal identifier characters. If illegal characters are detected, you will see an error like this: Warning. Can't wrap operator* unless renamed to a valid identifier. The only way to fix this is to use %rename or %name to bind the operator to a nice name like "add" or something. Note: the legal identifier characters are determined by the target language. There are certain issues with friend functions and operators. Sometimes, friends are used to define mixed operators such as adding a Complex and a double together. Currently, SWIG ignores all friend declarations in a class. A global operator declaration can probably be made to work, but you'll have to rename it and it probably won't work very cleanly in the target language since it's not a class member. SWIG doesn't know how to handle operator specifications sometimes used for automatic type conversion. For example: class String { ... operator const char*(); ... }; (this doesn't parse correctly and generates a syntax error). Also: operators no longer show up as separate parse-tree nodes (instead they are normal 'cdecl' nodes). I may separate them as a special case later. See Examples/python/operator for an example. *** SUPER-EXPERIMENTAL NEW FEATURE *** Version 1.3.9 (September 25, 2001) ================================== 9/25/2001: beazley Fixed parsing problem with type declarations like 'char ** const'. SWIG parsed this correctly, but the internal type was represented incorrectly (the pointers and qualifiers were in the wrong order). 9/25/2001: beazley Withdrew experimental feature (noted below) that was causing serious parsing problems. Version 1.3.8 (September 23, 2001) ================================== 9/23/2001: beazley Included improved distutils setup.py file in the Tools directory (look for the setup.py.tmpl file). Contributed by Tony Seward. 9/23/2001: beazley Included two new RPM spec files in the Tools directory. Contributed by Tony Seward and Uwe Steinmann. 9/21/2001: beazley Fixed SF Bug [ #463635 ] Perl5.swg does not compile in Visual C++ 9/21/2001: beazley Two new directives control the creation of default constructors and destructors: %nodefault %makedefault These replace %pragma nodefault and %pragma makedefault. (old code will still work, but documentation will only describe the new directives). 9/21/2001: beazley Fixed SF Bug [ #462354 ] %import broken in 1.3.7. 9/20/2001: beazley Parser modified to ignore out-of-class constructor and destructor declarations. For example: inline Foo::Foo() : Bar("foo") { } inline Foo::~Foo() { } Suggested by Jason Stewart. *** EXPERIMENTAL FEATURE *** 9/20/2001: beazley Modified the parser to ignore forward template class declarations. For example: template class MapIter; Suggested by an email example from Irina Kotlova. 9/20/2001: beazley Fixed problem with undeclared tcl_result variable in the "out" typemap for Tcl. Reported by Shaun Lowry. 9/20/2001: beazley Incorporated changes to make SWIG work with ActivePerl. Contributed by Joel Reed. 9/20/2001: beazley Slight change to the parsing of C++ constructor initializers. For example: class Foo : public Bar { public: Foo() : Bar(...) {...} }; SWIG now discards the contents of the (...) regardless of what might enclosed (even if syntactically wrong). SWIG doesn't need this information and there is no reason to needless add syntax rules to handle all of the possibilities here. 9/20/2001: beazley Change to typemaps for structure members. If you have a structure like this: struct Vector { int *bar; }; The member name 'bar' is now used in any accessor functions. This allows the "in" typemap to be used when setting the value. For example, this typemap %typemap(python,in) int *bar { ... } now matches Vector::bar. It should be noted that this will also match any function with an argument of "int *bar" (so you should be careful). *** NEW FEATURE. POTENTIAL INCOMPATIBILITY *** 9/20/2001: beazley Fixed SF bug #462642 setting string values in structures 9/20/2001: beazley Fixed SF bug #462398 problem with nested templates. 9/20/2001: beazley Fixed SF bug #461626 problem with formatting and C++ comments. 9/20/2001: beazley Fixed SF bug #462845 Wrong ownership of returned objects. 9/19/2001: beazley Fixed SF bug #459367. Default constructors for classes with pure virtual methods. 9/19/2001: beazley Fixed problem with default arguments and class scope. For example: class Foo { public: enum bar { FOO, BAR }; void blah(bar b = FOO); ... } SWIG now correctly generates a default value of "Foo::FOO" for the blah() method above. This used to work in 1.1, but was broken in 1.3.7. Bug reported by Mike Romberg. Version 1.3.7 (September 3, 2001) ================================== 9/02/2001: beazley Added special %ignore directive to ignore declarations. This feature works exactly like %rename. For example: %ignore foo; // Ignore all declarations foo %ignore ::foo; // Only ignore foo in global scope %ignore Spam::foo; // Only ignore in class Spam %ignore *::foo; // Ignore in all classes %ignore can also be parameterized. For example: %ignore foo(int); %ignore ::foo(int); %ignore Spam::foo(int); %ignore *::foo(int); *** NEW FEATURE *** 9/02/2001: cheetah (william fulton) [Java] shadowcode pragma modified so that the code that is output in the shadow file is placed relative to where it is placed in the c/c++ code. This allows support for JavaDoc function comments. 9/01/2001: beazley Fixed SF Patch [ #447791 ] Fix for python -interface option. Submitted by Tarn Weisner Burton. 9/01/2001: beazley SWIG no longer generates default constructors/destructors for a class if it only defines a private/protected constructor or destructor or if any one of its base classes only has private constructors/destructors. This was reported in SF Patch [ #444281 ] nonpublic/default/inhereted ctor/dtor by Marcelo Matus. 9/01/2001: beazley Added patch to Perl5 module that allows constants to be wrapped as constants that don't require the leading $. This feature is enabled using the -const option. Patch contributed by Rich Wales. *** NEW FEATURE *** 8/31/2001: beazley Added parsing support for the 'volatile' type qualifier. volatile doesn't mean anything to SWIG, but it is needed to properly generate prototypes for declarations that use it. It's also been added to make the SWIG type system more complete. *** NEW FEATURE *** 8/30/2001: beazley Added support for parameterized %rename directive. *** This new feature can be used to greatly simplify the task of resolving overloaded methods and functions. *** In prior versions of SWIG, the %rename directive was used to consistently apply an identifier renaming. For example, if you said this: %rename foo bar; Every occurrence of 'foo' would be renamed to 'bar'. Although this works fine for resolving a conflict with a target language reserved word, it is useless for for dealing with overloaded methods. This is because all methods are simply renamed to the same thing (generating the same conflict as before). Therefore, the only way to deal with overloaded methods was to go through and individually rename them all using %name. For example: class Foo { public: virtual void bar(void); %name(bar_i) virtual void bar(int); ... }; To make matters worse, you had to do this for all derived classes too. class Spam : public Foo { public: virtual void bar(void); %name(bar_i) virtual void bar(int); ... }; Needless to say, this makes it extremely hard to resolve overloading without a lot of work and makes it almost impossible to use SWIG on raw C++ .h files. To fix this, %rename now accepts parameter declarators. The syntax has also been changed slightly. For example, the following declaration renames all occurrences of 'bar(int)' to 'bar_i', leaving any other occurrence of 'bar' alone. %rename(bar_i) bar(int); Using this feature, you can now selectively rename certain declarations in advance. For example: %rename(bar_i) bar(int); %rename(bar_d) bar(double); // Include raw C++ header %include "header.h" When %rename is used in this manner, all occurrence of bar(int) are renamed wherever they might occur. More control is obtained through explicit qualification. For example, %rename(bar_i) ::bar(int); only applies the renaming if bar(int) is defined in the global scope. The declaration, %rename(bar_i) Foo::bar(int); applies the renaming if bar(int) is defined in a class Foo. This latter form also supports inheritance. Therefore, if you had a class like this: class Spam : public Foo { public: void bar(int); } The Spam::bar(int) method would also be renamed (since Spam is a subclass of Foo). This latter feature makes it easy for SWIG to apply a consistent renaming across an entire class hierarchy simply by specifying renaming rules for the base class. A class wildcard of * can be used if you want to renaming all matching members of all classes. For example: %rename(bar_i) *::bar(int); will rename all members bar(int) that are defined in classes. It will not renamed definitions of bar(int) in the global scope. The old use of %rename is still supported, but is somewhat enhanced. %rename(foo) bar; // Renames all occurrences of 'bar'. %rename(foo) ::bar; // Rename all 'bar' in global scope only. %rename(foo) *::bar; // Rename all 'bar' in classes only. %rename(foo) Foo::bar; // Rename all 'bar' defined in class Foo. *** NEW FEATURE *** 8/30/2001: beazley Added support for data-member to member-function transformation. For example, suppose you had a structure like this: struct Vector { double x,y; }; Now suppose that you wanted to access x and y through a member function interface instead of the usual SWIG behavior. For example: f.set_x(3.4) # instead of f.x = 3.4 x = f.get_x() # instead of x = f.x To do this, simply use the new %attributefunc directive. For example: %attributefunc(get_%s,set_%s) struct Vector { double x,y; }; %noattributefunc The arguments to %attributefunc are C-style printf format strings that determine the naming convention to use. %s is replaced with the actual name of the data member. SWIG provides a number of printf extensions that might help. For example, if you wanted to title case all of the attributes, you could do this: %attributefunc(get%(title)s,set%(title)s); This will turn an attribute 'bar' to 'getBar()' and 'setBar()'. (someone requested this long ago, but I finally figured how to implement it in a straightforward manner). *** EXPERIMENTAL NEW FEATURE *** 8/30/2001: beazley SWIG now automatically generates default constructors and destructors if none are defined. This used to be enabled with a command line switch -make_default, but most people want these functions anyways. To turn off this behavior use the -no_default option or include the following pragma in the interface file: %pragma no_default; This may break certain interfaces that defined their own constructors/destructors using the same naming convention as SWIG. If so, you will get duplicate symbols when compiling the SWIG wrapper file. *** POTENTIAL INCOMPATIBILITY *** 8/29/2001: beazley Changes to Perl5 shadow class code generation. Iterators are no longer supported (FIRSTKEY, NEXTKEY). Also, attribute access has been changed to rely on inheritance in order to provide better behavior across modules. 8/28/2001: beazley Various obscure improvements to the type system and classes. Strange declarations like this are now wrapped correctly (i.e., the generated wrapper code doesn't cause the C++ compiler to die with a type error). class Foo { public: typedef double Real; Real foo(Real (*op)(Real,Real), Real x, Real y); }; Inheritance of types is also handled correctly. 8/28/2001: beazley Changes to class wrappers. When SWIG sees two classes like this, class X { public: void foo(); ... } class Y : public X { public: void bar(); ... } it now only generates two wrapper functions: X_foo(X *x) { x->foo(); } Y_bar(Y *y) { y->bar(); } Unlike SWIG1.15, the foo() method does *not* propagate to a wrapper function Y_foo(). Instead, the base class method X_foo() must be used. This change should not affect modules that use shadow classes, but it might break modules that directly use the low-level C wrappers. This change is being made for a number of reasons: - It greatly simplifies the implementation of SWIG--especially with anticipated future changes such as overloaded methods. - It results in substantially less wrapper code--especially for big C++ class hierarchies (inherited declarations are no longer copied into every single derived class). - It allows for better code generation across multiple SWIG generated modules (code isn't replicated in every single module). *** POTENTIAL INCOMPATIBILITY *** 8/22/2001: cheetah (william fulton) Provided some Windows documentation in the Win directory and some Visual C++ project files for running examples on Windows. 8/28/2001: mkoeppe [Guile] Handle renamed overloaded functions properly; thanks to Marc Zonzon for the patch. See the new test case name_cxx. 8/27/2001: mkoeppe [Tcl] Removed lots of warnings issued by the Sun Forte compilers, which were caused by mixing function pointers of different linkages (C++/C). 8/23/2001: mkoeppe Improved the MzScheme module by porting Guile's pointer type checking system and making type dispatch typemap-driven. 8/22/2001: beazley Entirely new symbol table processing. SWIG should be able to report much better error messages for multiple declarations. Also, the new symbol table allows for overloaded functions (although overloading isn't quite supported in the language modules yet). 8/22/2001: cheetah (william fulton) * [Java] %new support added. * [Java] Package JNI name refixed! 8/19/2001: beazley Python module modified to support pointers to C++ members. This is an experimental feature. *** NEW FEATURE *** 8/19/2001: beazley Added limited parsing and full type-system support for pointers to members. None of SWIG's language modules really know how to deal with this so this is really only provided for completeness and future expansion. Note: SWIG does not support pointers to members which are themselves pointers to members, references to pointers to members, or other complicated declarations like this. *** NEW FEATURE *** 8/19/2001: beazley SWIG is much better at parsing certain C++ declarations. Operators and friends generally don't cause anymore syntax errors. However, neither are really supported. 8/18/2001: beazley Added *highly* experimental support for wrapping of C++ template declarations. Since C++ templates are essentially glorified macros and SWIG has a fully operational C preprocessor with macro support, the parser now converts template declarations to macros. For example, a function template like this template T max(T a, T b); is internally converted into a macro like this: %define %_template_max(__name,T) %name(__name) T max(T a, T b); %enddef To instantiate a version of the template, a special %template declaration is used like this: %template(maxint) max; %template(maxdouble) max; The parameter to the %template directive must be proper C identifier that's used to uniquely name the resulting instantiation. When used, the the expanded macro looks like this: %name(maxint) int max(int a, int b); %name(maxdouble) double max(double a, double b); A similar technique is used for template classes. For instance: template class vector { T *data; int sz; public: vector(int nitems); T *get(int n); ... }; Gets converted into a macro like this: %define %_template_vector(__name, T) %{ typedef vector __name; %} class __name { T *data; int sz; public: __name(int nitems); T *get(int n); ... }; typedef __name vector; %enddef An a specific instantiation is created in exactly the same way: %template(intvec) vector; The resulting code parsed by SWIG is then: %{ typedef vector intvec; %} class intvec { int *data; int sz; public: intvec(int nitems); int *get(int n); ... }; typedef intvec vector; Note: the last typedef is non-standard C and is used by SWIG to provide an association between the name "intvec" and the template type "vector". CAUTION: This is an experimental feature and the first time SWIG has supported C++ templates. Error reporting is essential non-existent. It will probably break in certain cases. *** EXPERIMENTAL NEW FEATURE **** 8/15/2001: beazley Change to wrapping of multi-dimensional arrays. Arrays are now properly mapped to a pointer to an array of one less dimension. For example: int [10]; --> int * int [10][20]; --> int (*)[20]; int [10][20][30]; --> int (*)[20][30]; This change may break certain SWIG extensions because older versions simply mapped all arrays into a single pointer such as "int *". Although possibly unusual, the new version is correct in terms of the C type system. *** POTENTIAL INCOMPATIBILITY *** 8/06/2001: cheetah (william fulton) * [Java] Array setters generated for struct/class array members. 8/13/2001: beazley Many improvements to Tcl/Perl/Python modules to better work with multiple interface files and the %import directive. 8/13/2001: beazley Fixed up the behavior of %import in the Python module. SWIG no longer pollutes the module namespace by using 'from module import *' to refer to the other module. Instead, it does a proper 'import module'. Also, SWIG may work a lot better when importing modules that include references to other imported modules. 8/13/2001: mkoeppe Added new typemap substitutions, generalizing those of the Guile-specific 5/27/2001 changes: * $descriptor is the same as SWIGTYPE$mangle, but also ensures that the type descriptor of this name gets defined. * $*type, $*ltype, $*mangle, $*descriptor are the same as the variants without star, but they REMOVE one level of pointers from the type. (This is only valid for pointer types.) * $&type, $<ype, $&mangle, $&descriptor are the same as the variants without ampersand, but they ADD one level of pointers to the type. The Guile-specific substitution $basedescriptor was removed because it was useless. 8/12/2001: beazley The %extern directive is now deprecated and withdrawn. The purpose of this directive was to import selected definitions from other interface files and headers. However, the same functionality is better handled through %import. This leaves SWIG with two file inclusion directives: %include filename - Inserts into current interface %import filename - Import types and classes from another module *** POTENTIAL INCOMPATIBILITY *** 8/09/2001: beazley Added new support for wrapping C/C++ callback functions. A common problem with some C libraries is that many functions take a function pointer as an argument. For example: int do_op(..., int (*op)(int,int), ...); Unfortunately, the only way to call such a function is to pass it a function pointer of some compatible type. In previous versions of SWIG, you had to solve this problem with some really gross hacks. For example, if you wanted to use the following function as a callback, int foo(int, int); you had to install a pointer to it as a constant. For example: %constant int (*FOO)(int,int) = foo; or const int (*FOO)(int,int) = foo; or if you had a really old SWIG version: typedef int (*OP_FUNC)(int,int); int do_op(..., OP_FUNC, ...); const OP_FUNC FOO = foo; Now, you can do one of two things: %constant int foo(int,int); This creates a constant 'foo' of type int (*)(int,int). Alternatively, you can do this: %callback("%s"); int foo(int,int); int bar(int,int); %nocallback; In this case, the functions are installed as constants where the name is defined by the format string given to %callback(). If the names generated by the format string differ from the actual function name, both a function wrapper and a callback constant are created. For example: %callback("%(upper)s"); int foo(int,int); int bar(int,int); %nocallback; Creates two wrapper functions 'foo', 'bar' and additionally creates two callback constants 'FOO', 'BAR'. Note: SWIG still does not provide automatic support for writing callback functions in the target language. *** NEW FEATURE *** 8/06/2001: cheetah (william fulton) * struct nesting fixes as per SF bug #447488. 8/03/2001: beazley The %name directive now applies to constants created with #define and %constant. However, most language modules were never written to support this and will have to be modified to make it work. Tcl, Python, and Perl modules are working now. *** NEW FEATURE *** 8/03/2001: beazley Massive changes and simplification of C declaration parsing. Although SWIG is still not a full C parser, its ability to handle complex datatypes including pointers to functions and pointers to arrays has been vastly improved. 8/03/2001: cheetah (william fulton) * Distribution fixes: autoconf no longer needed to install SWIG. 8/02/2001: beazley Removed two undocumented parsing features. SWIG no longer supports out-of-class static function or variable declarations. For example: static int Foo::bar; This feature may return if there is sufficient demand. However, since SWIG is most often used with header files, it is more likely for these definitions to be included in the class definition. *** POTENTIAL INCOMPATIBILITY *** 8/02/2001: cheetah (william fulton) * Cleanup of the GIFPlot examples. Upgraded Java GIFPlot example. 8/01/2001: cheetah (william fulton) * [Java] Efficiency changes: _cPtr used where possible rather than getCPtr(). Bug fixes for inheritance - derived class sometimes didn't delete the c memory when _delete() was called. * [Java] Abstract c++ classes are wrapped with a java abstract shadow class. Also a pure virtual function is mapped with an abstract method. * The default output file has always been _wrap.c. It is now _wrap.cxx if the -c++ commandline option is passed to swig. This has been done as otherwise c++ code would appear in a c file. *** POTENTIAL INCOMPATIBILITY *** 7/31/2001: beazley Modified the %constant directive to be more C-like in syntax. The syntax is now: %constant NAME = VALUE; %constant TYPE NAME = VALUE; For example: %constant Foo *Bar = &Spam; A more subtle case is as follows: %constant int (*FOO)(int,int) = blah; *** POTENTIAL INCOMPATIBILITY *** Modules that were using the %constant directive directly will need to be modified. 7/30/2001: beazley Removed obscure and undocumented form of the %inline directive: %inline int blah(int a, int b) { ... } *** POTENTIAL INCOMPATIBILITY *** (note: this feature was never documented and is withdrawn) 7/30/2001: beazley Removed support for functions with no explicitly declared return type. For example: foo(int); In C, such functions were implicitly assumed to return an 'int'. In C++, this is illegal. Either way, it's considered bad style. Removing support for this in SWIG will simplify certain issues in parsing. *** POTENTIAL INCOMPATIBILITY *** 7/30/2001: mkoeppe * Partial merge from the CVS trunk. The Source/DOH directory and most of the Source/Swig directory is up-to-date now. * [Guile] %scheme is now a macro for %insert("scheme"). New syntax: %scheme "FILENAME"; New syntax: %scheme %{ SCHEME-CODE %} New macros %multiple_values, %values_as_list, %values_as_vector. 7/29/2001: beazley %readonly and %readwrite have been turned into SWIG pragmas. %pragma(swig) readonly and %pragma(swig) readwrite. Macros are used to provide backwards compatibility. 7/29/2001: beazley Minor changes to %pragma directive. %pragma must always be directed to a specific language. For example: %pragma(swig) make_default; %pragma(perl5) include = "blah.i"; Also extended the pragma directive to allow code blocks %pragma(foo) code = %{ ... some code ... %} *** POTENTIAL INCOMPATIBILITY *** 7/29/2001: beazley Change to the way 'const' variables are wrapped. In previous versions of SWIG, a 'const' variable was wrapped as a constant. Now, 'const' variables are wrapped as read-only variables. There are several reasons for making this change, mostly pertaining to subtle details of how 'const' actually works. This will probably break old interfaces that used 'const' to create constants. As a replacement, consider using this: const int a = 4; ===> %constant int a = 4; *** POTENTIAL INCOMPATIBILITY *** 7/29/2001: beazley Reorganization and simplification of type parsing. Types with 'const' should work correctly now. 7/29/2001: beazley Most swig directives related to the documentation system are now deprecated. 7/29/2001: beazley Removed support for Objective-C in order to simplify parser reconstruction. Will return if there is sufficient demand. *** POTENTIAL INCOMPATIBILITY *** 7/29/2001: beazley Code inclusion has been modified in the parser. A common directive %insert is now used for everything. This inserts a file into the output: %insert(header) "foo.swg" This inserts some inline code into the output %insert(header) %{ ... some code ... %} There are five predefined targets for the insert directive: "header" - Header section of wrapper file "runtime" - Runtime section of wrapper file "wrapper" - Wrapper section "init" - Initialization function "null" - Nothing. Discard. The following directives are still supported, but are now defined in terms of macros: %{ ... %} -> %insert(header) %{ ... %} %init %{ ... %} -> %insert(init) %{ ... %} %wrapper %{ ... %} -> %insert(wrapper) %{ ... %} %runtime %{ ... %} -> %insert(runtime) %{ ... %} Language modules can define new named targets by using the C API function Swig_register_filebyname() (see main.cxx). For example, if you wanted to expose a shadow class file, you could do this: Swig_register_filebyname("shadow", f_shadow); Then in the interface file: %insert(shadow) %{ ... %} Note: this change should not affect any old interfaces, but does open up new possibilities for enhancements. 7/29/2001: beazley SWIG now always includes a standard library file 'swig.swg'. This file defines a large number of macro definitions that define the behavior of various SWIG directives. Previously, all SWIG directives were handled as special cases in the parser. This made the parser a large bloated mess. Now, the parser is stripped down to a few simple directives and macros are used to handle everything else. 7/26/2001: cheetah (william fulton) * Fixes for Sourceforge bug #444748 - new testcase cpp_static: [TCL] Class with just static member variable/function fix [Java] Fixed static variables support [Ruby] Static variables workaround removed 7/27/2001: mkoeppe * stype.c (SwigType_default): Strip qualifiers first. The default type of "int * const" is now "SWIGPOINTER *". * main.cxx: Define "__cplusplus" in SWIG's preprocessor if in C++ mode. * [Guile]: Added some support for arrays and C++ references, fixing the "constant_pointers" test case. * Moved most tests from the old Guile-specific test-suite to the new test-suite. Also moved perl5/pointer-cxx example there. 7/26/2001: cheetah (william fulton) * Test-suite added. * Initial testcases: constant_pointers cpp_enum defines sizeof_pointers unions virtual_destructor * Make clean improvements. 7/24/2001: cheetah (william fulton) * [Java] Underscores in the package name and/or module name no longer give linking problems. 7/17/2001: cheetah (william fulton) * More parser bug fixes for constant pointers 7/19/2001: mkoeppe * [Guile] Aesthetic improvement in variable wrappers. 7/18/2001: beazley * Fixed core-dump problem in pointer library when freeing character arrays. SF Bug [ #415837 ] pointer lib core dump 7/18/2001: beazley * Fixed problem with default destructors and shadow classes. SF bug #221128. 7/18/2001: beazley * To provide better line-number tracking in interfaces with lots of macros, special locator comments are now generated by the SWIG preprocessor. For example: /*@foo.i,42,BLAH@*/expanded macro/*@@*/ The first /*@...@*/ sequence sets the context to point to the macro code. The /*@@*/ comment terminates the context. The SWIG parser should ignore all of the locator comments as should the C compiler (should such comments end up in generated wrapper code). 7/18/2001: mkoeppe * The parser now handles severely constified types in typemaps. This introduced a new shift/reduce conflict, but only with a heuristic function-pointer catch-all rule. * [Guile]: Added typemaps for severely constified types. * Fixed the "template-whitespace" problem by canonicalizing whitespace, especially around angle brackets and commas. 7/17/2001: mkoeppe * [Guile]: A Scheme file is emitted if the -scmstub FILE.SCM command-line option is used. The %scheme directive (implemented as a macro for a pragma) allows to insert arbitrary code here. In "simple" and "passive" linkage, the file gets filled with define-module and export declarations. 7/17/2001: cheetah (william fulton) * Parser bug fix to support constant pointers, eg int* const ptr. Fixed everywhere - variables, parameters, return types etc. Note that when wrapping a constant pointer variable only the getter is generated. 7/17/2001: mkoeppe * Fixed SF bug #441470 (#define X "//" would not be parsed, see test-suite entry "preproc-1"), reported by T. W. Burton . * Changed the type of character constants to "char", rather than "char *". Changed the individual language modules to keep the old behaviour, except for the Guile module, where it is desired to make them Scheme characters. This fixes SF bug #231409, test-suite entry "char-constant". * Applied patch for DOH/Doh/memory.c by Les Schaffer (avoid required side effects in assert). 7/17/2001: cheetah (william fulton) * Bug fix in parser for virtual destructor with void as parameter * Bug fix in parser #defines embedded within classes/structs/unions Consequently %constant can now also be placed within a struct/class/union. * Bug fix in parser to allow sizeof(*I_am_a_pointer) within a #define 7/16/2001: mkoeppe * Added changes for the Macintosh contributed by Luigi Ballabio . * Some "const" fixes in the code. * [Guile]: Made the constant-wrapper functions much shorter. 7/13/2001: mkoeppe * [Guile]: Some "const" fixes for Guile version 1.3.4. * Handle anonymous arguments with default values and static array members of classes. Both bugs reported by Annalisa Terracina ; see the files Examples/guile/test-suite/static-array-member.i and anonymous-arg.i. Version 1.3.6 (July 9, 2001) ============================= 7/09/2001: cheetah (william fulton) * GIFPlot examples: FOREGROUND and BACKGROUND definition missing after TRANSPARENT #define fix in GIFPlot 7/03/2001: beazley Fixed up the version numbers so that the release is known as 1.3.6. All future releases should have a similar version format. 7/02/2001: mkoeppe * [Python]: Prevent the problem of self.thisown not being defined if the C++ class constructor raised an exception. Thanks to Luigi Ballabio . 6/29/2001: mkoeppe * More portability fixes; fixed "gcc -Wall" warnings. 6/29/2001: cheetah (william fulton) * GIFPlot examples: TRANSPARENT #define multiple times on Solaris (clashes with stream.h). * Multiple definition bug fix for shadow classes. The perl and python modules had workarounds which have been replaced with fixes in the core. Many of the Language::cpp_xxxx functions now set a flag which the derived classes can access through is_multiple_definition() to see whether or not code should be generated. The code below would have produced varying degrees of incorrect shadow class code for the various modules: class TestClass { public: TestClass() {} TestClass(int a) {} ~TestClass() {} unsigned long xyz(short k) {} unsigned long xyz(int n) {} static void static_func() {} static void static_func(int a) {} }; void delete_TestClass(int a); 6/27/2001: mkoeppe * [Perl] Another const-related portability fix. 6/26/2001: cheetah (william fulton) * [Java] Added in cpp_pragma() support with a host of new pragmas - see jswig.html. These are designed for better mixing of Java and c++. It enables the user to specify pure Java classes as bases and/or interfaces for the wrapped c/c++. * [Java] Old pragmas renamed. Warning given for the moment if used. *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE *** 6/25/2001: mkoeppe * Incorporated more build changes contributed by Wyss Clemens for swig/ruby on cygwin. 6/20/2001: cheetah (william fulton) * Makefile mods so that 'make check' uses the swig options in the makefiles * [Java] Removed Generating wrappers message * [Java] NULL pointer bug fix * [Java] Bug fix for Kaffe JVM 6/20/2001: mkoeppe * SWIG_TypeQuery from common.swg now returns a swig_type_info* rather than a void*. This fixes a problem when using pointer.i and C++, as illustrated by the new test-suite example perl5/pointer-cxx. * Portability fixes (const char *). * Incorporated build changes contributed by Wyss Clemens , which make swig runnable on cygwin. 6/19/2001: cheetah (william fulton) * [Java] Bug fix for SF bug #211144. This fix is a workaround until fixed in the core. 6/19/2001: mkoeppe * [Guile]: Portability fixes for use with the Sun Forte compilers. * [Tcl]: Portability fix (const char *). * [Tcl]: Configure now first tries to find a tclConfig.sh file in order to find the Tcl include directory, library location and library name. * [Python]: Added a few possible library locations. 6/18/2001: mkoeppe * [Guile]: Don't call scm_c_export if nothing is to be exported. Don't warn on %module if module has been set already (this frequently occurs when %import is used). 6/16/2001: mkoeppe * [Guile]: New "passive" linkage, which is appropriate for multi-module extensions without Guile module magic. 6/15/2001: mkoeppe * [Guile]: Fixed printing of smobs (space and angle were missing). * Properly generate type information for base classes imported with the %import directive. Thanks to Marcelo Matus for the report and the patch; this closes SF bug #231619; see also Examples/guile/test-suite/import*. * [Guile]: Fix casting between class and base class; the runtime type system had it the wrong way around; see Examples/guile/test-suite/casts.i * Make typemaps for SWIGPOINTER * with arg name take precedence over those without arg name, to match normal typemap precedence rules. * Fixed the random-line-numbers problem reported as SF bug #217310; thanks to Michael Scharf . * [Guile]: Handle the %name and %rename directives. * New syntax: %name and %rename now optionally take double quotes around the scripting name. This is to allow scripting names that aren't valid C identifiers. 6/14/2001: beazley Made a minor change to the way files are loaded in order to get file/line number reporting correct in the preprocessor. 6/14/2001: mkoeppe * The parser now understands the (non-standard) "long long" types. It is up to the individual language modules to provide typemaps if needed. Reported by Sam Steingold, SF bug #429176. * The parser now understands arguments like "const int * const i". This fixes SF bug #215649. * Fixed the Guile test-suite. 6/13/2001: mkoeppe Partial merge from the CVS trunk at tag "mkoeppe-merge-1". This covers the following changes: | 01/16/01: ttn | Wrote table of contents for Doc/engineering.html. Added section | on CVS tagging conventions. Added copyright to other docs. | 9/25/00 : beazley | Modified the preprocessor so that macro names can start with a '%'. | This may allow new SWIG "directives" to be defined as macros instead | of having to be hard-coded into the parser. | | *** Also a yet-to-be-documented quoting mechanism with backquotes | *** has been implemented? 6/13/2001: mkoeppe * When configure does not find a language, don't use default paths like /usr/local/include; this only causes build problems. * New directory: Examples/Guile/test-suite, where a few bugs in 1.3a5 are demonstrated. * Handle C++ methods that have both a "const" and a "throw" directive (see Examples/Guile/test-suite/cplusplus-throw.i); thanks to Scott B. Drummonds for the report and the fix. * Handle C++ pointer-reference arguments (like "int *& arg") (see Examples/Guile/test-suite/pointer-reference.i, reported as SF bug #432224). * [Ruby] Fixed typo in rubydec.swg; thanks to Lyle Johnson! * Don't stop testing when one test fails. * [Guile, MzScheme] Don't print "Generating wrappers...". 6/12/2001: mkoeppe [Guile] VECTORLENINPUT and LISTLENINPUT now have separate list length variables. TYPEMAP_POINTER_INPUT_OUTPUT attaches argument documentation involving SCM_TYPE to the standard pointer typemaps. INOUT is now an alias for BOTH. 6/12/2001: cheetah (william fulton) Some Java documentation added. [Java] Fixed bugs in import pragma and shadow pragma. 6/12/2001: mkoeppe Fix declarations of SWIG_define_class (Lib/ruby/rubydec.swg) and SWIG_TypeQuery (Lib/common.swg). Thanks to Lyle Johnson for the patches. 6/11/2001: mkoeppe [Guile] Use long instead of scm_bits_t; this makes the generated wrapper code compatible with Guile 1.3.4 again. Thanks to Masaki Fukushima for pointing this out. 6/11/2001: cheetah (william fulton) The generic INSTALL file from autoconf added. Few changes to README file. 6/11/2001: mkoeppe Fixed typo in Makefile.in; thanks to Greg Troxel . 6/08/2001: cheetah (william fulton) make check works again. Examples/GIFPlot configure generated by top level autoconf now. 6/08/2001: mkoeppe Another build change: The new script autogen.sh runs autoconf in the appropriate directories. The top-level configure also configures in Examples/GIFPlot. 6/07/2001: mkoeppe Made the Makefile work with non-GNU make again. 6/07/2001: cheetah (william fulton) [Java] Class/struct members that are arrays of pointers to classes/structs - Shadow class's get/set accessors now use Java classes instead of longs (pointers). [Java] Shadow classes will now clean up memory if function return type is a class/struct. [Java] New example called reference based on the same example from other modules. 6/06/2001: mkoeppe New configure option --with-release-suffix allows for attaching a suffix to the swig binary and the swig runtime libraries. Minor changes to the build system. "swig -swiglib" works again. If invoked with the new option "-ldflags", SWIG prints a line of linker flags needed to link with the runtime library of the selected language module. 6/06/2001: mkoeppe [Guile] gswig_list_p is an int, not a SCM. This typo caused warnings when compiling with a Guile configured with strict C type checking. In INPUT and BOTH typemaps generated by the SIMPLE_MAP macro, use the SCM_TO_C function to convert from Guile to C (rather than C_TO_SCM). Use scm_intprint to print pointers (rather than sprintf). Allow using "-linkage" instead of "-Linkage". 6/05/2001: cheetah (william fulton) [Java] Mods for using inherited c++ classes from Java [Java] New example called class based on the same example from other modules 6/05/2001: cheetah (william fulton) [Java] destructor (_delete()) was not aware of %name renaming [Java] extends baseclass did not know about %name renaming [Java] extends baseclass did extend even when the baseclass was not known to swig [Java] sometimes enum-declarations occurred before the Java class declaration [Java] unrelated enum initialisations no longer appear in Java class [Java] if module ends in '_' correct JNI names are now produced 6/04/2001: cheetah (william fulton) [Java] Shadow class mods - Modified constructor replaces newInstance(). _delete() now thread safe. getCPtr() replaces _self. _selfClass() removed as now redundant. *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE *** [Java] Not all output java files had SWIG banner. New banner. [Java] Shadow class finalizers are output by default: Command line option -finalize deprecated and replaced with -nofinalize. *** POTENTIAL INCOMPATIBILITY FOR JAVA MODULE *** 6/ 1/2001: mkoeppe [Guile] Cast SCM_CAR() to scm_bits_t before shifting it. This is required for compiling with a Guile configured with strict C type checking. 6/ 1/2001: mkoeppe Added configure option "--with-swiglibdir". 5/31/2001: mkoeppe [Guile] Support multiple parallel lists or vectors in the typemaps provided by list-vector.i. New typemaps file, pointer-in-out.i. 5/25/2001: cheetah (william fulton) [Java] HTML update for examples. 5/28/2001: mkoeppe Minor changes to the build system. Added subdirectory for Debian package control files. 5/28/2001: mkoeppe [Guile] Build a runtime library, libswigguile. 5/28/2001: mkoeppe [Guile] New typemap substitution $*descriptor. Use the {} syntax, rather than the "" syntax for the standard typemaps, in order to work around strange macro-expansion behavior of the SWIG preprocessor. This introduces some extra braces. 5/27/2001: mkoeppe [Guile] Handle pointer types with typemaps, rather than hard-coded. New typemap substitutions $descriptor, $basedescriptor; see documentation. Some clean-up in the variable/constants wrapper generator code. New convenience macro SWIG_Guile_MustGetPtr, which allows getting pointers from smobs in a functional style. New typemap file "list-vector.i", providing macros that define typemaps for converting between C arrays and Scheme lists and vectors. 5/25/2001: cheetah (william fulton) [Java] STL string moved into its own typemap as it is c++ code and it break any c code using the typemaps.i file. - Fixes for wrappers around global variables - applies to primitive types and user types (class/struct) and pointers to these. - Structure member variables and class public member variables getters and setters pass a pointer to the member as was in 1.3a3 and 1.1 (1.3a5 was passing by value) - Parameters that were arrays and return types were incorrectly being passed to create_function() as pointers. - Fix for arrays of enums. [Java] Updated java examples and added two more. [Java] Java module updated from SWIG1.3a3 including code cleanup etc. [Java] enum support added. [Java] Array support implemented [Java] Shadow classes improved - Java objects used rather than longs holding the c pointer to the wrapped structure/c++class 5/22/2001: mkoeppe [Guile] Fixed extern "C" declarations in C++ mode. Thanks to Greg Troxel . 5/21/2001: mkoeppe [Guile] New linkage "module" for creating Guile modules for Guile versions >= 1.5.0. 4/18/2001: mkoeppe [MzScheme] Added typemaps for passing through Scheme_Object pointers. 4/9/2001 : mkoeppe [MzScheme] Added typemaps for `bool'. Inclusion of headers and support routines is now data-driven via mzscheme.i. Headers come from the new file mzschemdec.swg. Don't abort immediately when a type-handling error is reported. When searching for typemaps for enums, fall back to using int, like the Guile backend does. Support char constants. Emit correct wrapper code for variables. 3/12/2001: mkoeppe [Guile] Fixed typemaps for char **OUTPUT, char **BOTH. 3/2/2001 : mkoeppe [Guile] Every wrapper function now gets a boolean variable gswig_list_p which indicates whether multiple values are present. The macros GUILE_APPEND_RESULT, GUILE_MAYBE_VALUES and GUILE_MAYBE_VECTOR use this variable, rather than checking whether the current return value is a list. This allows for typemaps returning a list as a single value (a list was erroneously converted into a vector or a multiple-value object in this case). 3/1/2001 : mkoeppe [Guile] Added support for returning multiple values as vectors, or passing them to a muliple-value continuation. By default, multiple values still get returned as a list. 3/1/2001 : mkoeppe [Guile] Added a "beforereturn" pragma. The value of this pragma is inserted just before every return statement. 3/1/2001 : mkoeppe [Guile] Added support for Guile 1.4.1 procedure documentation formats, see internals.html. 2/26/2001: mkoeppe [Guile] Made the wrapper code compile with C++ if the "-c++" command-line switch is given. Thanks to . 2/26/2001: mkoeppe [Guile] Now two type tables, swig_types and swig_types_initial, are used, as all other SWIG language modules do. This removes the need for the tricky construction used before that the broken Redhat 7.0 gcc doesn't parse. Reported by . 2/26/2001: mkoeppe [Guile] Fixed typemaps for char *OUTPUT, char *BOTH; a bad free() would be emitted. Added typemap for SCM. Version 1.3 Alpha 5 =================== 9/19/00 : beazley [Python] Python module generates more efficient code for creating the return value of a wrapper function. Modification suggested by Jon Travis. 9/19/00 : beazley Library files specified with the -l option are now included at the end of the interface file (reverting to the old behavior). 9/19/00 : beazley Fixed some problems with enum handling. enums are now manipulated as 'int', but cast into the enum type when values are passed to the corresponding C function. 9/19/00 : mkoeppe [Guile] Removed "-with-smobs" command-line option, as this is the default now. Added "-emit-setters" command-line option, which turns on generating procedures-with-setters; see internals.html. 9/18/00 : mkoeppe Incorporated patch #101430, fixing bugs in the Guile module: 1. Some arguments were erroneously taken as *optional* arguments when ignored arguments were present. 2. Guile 1.3.4 was not supported since functions introduced in Guile 1.4 were used. 3. Added handling of `const char *'. 9/17/00 : beazley Fixed problem with failed assertion and large files. 9/17/00 : beazley Fixed problem with the '%' character appearing in added methods and function bodies. Preprocessor bug. Version 1.3 Alpha 4 (September 4, 2000) ======================================= 9/3/00 : ttn Added instructions for maintainers in Examples/README on how to make examples also be useful in the testing framework. Also, "make check" now uses ./Lib by via env var `SWIG_LIB'. This is overridable like so: make chk-swiglib=/my/experimental/swig/Lib check 9/3/00 : beazley Added $typemap variable to typemaps. This gets replaced with a string indicating the typemap that is applied. Feature request from rsalz. 9/3/00 : beazley Experimental optimization to code generation for virtual member functions. If you have two classes like this: class A() { virtual void foo(); } class B() : public A { virtual void foo(); } Swig now will generate a single wrapper function for this A_foo(A *a) { a->foo(); } and use it as the implementation of both A_foo() and B_foo(). This optimization only takes place if both methods are declared as virtual and both take identical parameters. *** EXPERIMENTAL FEATURE *** 9/3/00 : beazley Restored the "memberin" typemap for setting structure members. Unlike the old version, the new version is expanded inline in the wrapper function allowing access to scripting language internals (a sometimes requested feature). The "memberout" typemap is gone. Use the "out" typemaps instead. *** POTENTIAL INCOMPATIBILITY *** 9/3/00 : beazley Attribute set methods no longer return the value of a member. For example: struct Foo { int x; ... } now gets set as follows: void Foo_x_set(Foo *f, int x) { f->x = x; } In SWIG1.1 it used to be this: int Foo_x_set(Foo *f, int x) { return (f->x = x); } This has been changed due to the complexity created by trying to do this with more exotic datatypes such as arrays. It also complicates inlining and handling of the "memberin" typemap. *** POTENTIAL INCOMPATIBILITY *** 9/2/00 : beazley Removed the ptrcast() and ptrmap() functions from the pointer.i library file. Old implementation is incompatible with new type system. *** POTENTIAL INCOMPATIBILITY *** 9/2/00 : beazley New runtime function SWIG_TypeQuery(const char *name) added. This function can be used to extract the type info structure that is used for type-checking. It works with either the nice C name or mangled version of a datatype. For example: swig_type_info *ty = Swig_TypeQuery("int *"); swig_type_info *ty = Swig_TypeQuery("_p_int"); This is an advanced feature that has been added to support some exotic extension modules that need to directly manipulate scripting language objects. *** NEW FEATURE *** 9/2/00 : beazley New directive %types() added. This is used to explicitly list datatypes that should be included in the runtime type-checking code. Normally it is never necessary to use this but sometimes advanced extensions (such as the pointer.i library) may need to manually add types to the type-checker. *** NEW FEATURE *** 8/31/00 : beazley Improved handling of string array variables. For example, a global variable of the form "char name[64]" is automatically managed as a 64 character string. Previously this didn't work at all or required the use of a special typemap. *** NEW FEATURE (Tcl, Perl, Python) *** 8/31/00 : ttn Added Makefile target `check-c++-examples', which uses new files under Examples/C++ contributed by Tal Shalif. Now "make check" also does "make check-c++-examples". Also, expanded actions in `check-gifplot-example' and `check-aliveness'. 8/30/00 : mkoeppe Major clean-up in the Guile module. Added typemap-driven documentation system. Changed to handle more than 10 args. Updated and extended examples. *** NEW FEATURE *** 8/29/00 : beazley Added new %insert directive that inserts the contents of a file into a portion of the output wrapper file. This is only intended for use by writers of language modules. Works as follows: %insert(headers) "file.swg"; %insert(runtime) "file.swg"; %insert(wrappers) "file.swg"; %insert(init) "file.swg"; *** NEW FEATURE *** 8/29/00 : beazley Added new %runtime directive which includes code into the runtime portion of the wrapper code. For example: %runtime %{ ... some internal runtime code ... %} There is no practical reason for ordinary users to use this feature (almost everything can be done using %{ ... %} instead). However, writers of language modules may want to use this in language configuration files. *** NEW FEATURE *** 8/28/00 : beazley Typemaps can now be specified using string literals like this: %typemap(in) int "$target = SvIV($source);"; When code is specified like this, it is *NOT* enclosed inside a local scope (as with older typemap declarations). Note: character escape sequences are interpreted in the code string so if you want to include a quote or some other special character, make sure you use a (\). *** NEW FEATURE *** 8/27/00 : beazley Typemaps have been modified to follow typedef declarations. For example, if you have this: typedef int Number; %typemap(in) int { ... get an integer ... } void foo(Number a); The typemap for 'int' will be applied to the argument 'Number a'. Of course, if you specify a typemap for 'Number' it will take precedence (nor will it ever be applied to an 'int'). *** POTENTIAL INCOMPATIBILITY *** 8/27/00 : beazley Default typemap specification has changed. In older versions of swig, you could do this: %typemap(in) int SWIG_DEFAULT_TYPE { ... } To specify the default handling of a datatype. Now that SWIG follows typedef declarations, this is unnecessary. Simply specifying a typemap for 'int' will work for all variations of integers that are typedef'd to 'int'. Caveat, specifying the default behavior for pointers, references, arrays, and user defined types is a little different. This must be done as follows: %typemap() SWIGPOINTER * { ... a pointer ... } %typemap() SWIGREFERENCE & { ... a reference ... } %typemap() SWIGARRAY [] { ... an array ... } %typemap() SWIGTYPE { ... a user-defined type (by value) ... } *** POTENTIAL INCOMPATIBILITY *** 8/15/00 : dustin The file swig-1.3a1-1.spec has been added to the Tools directory. It can be used to build a redhat package for SWIG, although it will need to be updated for the next public release. 8/15/00 : beazley Typemaps have been completely rewritten. Eventually they may be replaced with something better, but for now they stay. However, there are a number of a significant changes that may trip some people up: 1. Typemap scoping is currently broken. Because of this, the following code won't work. %typemap(in) blah * { ... } class Foo { ... int bar(blah *x); } %typemap(in) blah *; /* Clear typemap */ (this breaks because the code for the class Foo is actually generated after the entire interface file has been processed). This is only a temporary bug. 2. In SWIG1.1, the %apply directive worked by performing a very complex type-aliasing procedure. From this point on, %apply is simply a generalized typemap copy operation. For example, %apply double *OUTPUT { double *x, double *y }; Copies *ALL* currently defined typemaps for 'double *OUTPUT' and copies them to 'double *x' and 'double *y'. Most people probably won't even notice this change in %apply. However, where it will break things is in code like this: %apply double *OUTPUT { double *x }; %typemap(in) double *OUTPUT { ... whatever ... } void foo(double *x); In SWIG1.1, you will find that 'foo' uses the 'double *OUTPUT' rule even though it was defined after the %apply directive (this is the weird aliasing scheme at work). In SWIG1.3 and later, the 'double *OUTPUT' rule is ignored because it is defined after the %apply directive. 3. The %clear directive has been modified to erase all currently defined typemaps for a particular type. This differs from SWIG1.1 where %clear only removed rules that were added using the %apply directive. 4. Typemap matching is now performed using *exact* types. This means that things like this %typemap(in) char * { } %typemap(in) const char * { } are different typemaps. A similar rule applies for pointers, arrays, and references. For example: %typemap(in) double * { } used to apply to 'double &', 'double []', Now, it only applies to 'double *'. If you want a 'double &', you'll need to handle that separately. 5. Array matching has been simplfied. In SWIG1.1, array matching was performed by trying various combinations of dimensions. For example, 'double a[10][20]' was matched as follows: double [10][20] double [ANY][20] double [10][ANY] double [ANY][ANY] In SWIG1.3, only the following matches are attempted: double [10][20] double [ANY][ANY] On the positive side, typemap matching is now *significantly* faster than before. *** POTENTIAL INCOMPATIBILITY *** 8/15/00 : beazley Secret developer feature. Since datatypes are now represented as strings internally, you can bypass limitations of the parser and create a wild datatype by simply enclosing the raw string encoding in backticks (``) and sticking it in the interface file anywhere a type is expected. For example, `a(20).a(10).p.f(int,int)`. This feature is only intended for testing (i.e., you want to see what happens to your language module if it gets a reference to a pointer to an array of pointers to functions or something). *** SICK HACK *** 8/14/00 : beazley Completely new type-system added to the implementation. More details later. 8/11/00 : beazley Cleaned up some of the I/O handling. SWIG no longer generates any temporary files such as _wrap.wrap, _wrap.ii, _wrap.init. Instead, these "files" are kept around in memory as strings (although this is transparent to language modules). 8/4/00 : ttn Added Makefile target "check" and variants. This can be used like "make check" or, to explicitly skip a language LANG: "make skip-LANG=true check". LANG is skipped automatically if ./configure determines that LANG support is insufficient. Currently, the check is limited to doing the equivalent of "make all" in some of the Examples directories. This should be expanded both horizontally (different types of tests) and vertically (after "make all" in an Examples subdir succeeds, do some additional tests with the resulting interpreter, etc). 8/4/00 : ttn Added Makefile target "distclean", which deletes all the files ./configure creates, including config.status and friends. 8/3/00 : harcoh java changes??? [todo: document changes] 7/23/00 : beazley Typemaps have been modified to key off of the real datatypes used in the interface file. This means that typemaps for "const char *" and "char *" will be difference as will typemaps for "Vector" and "Vector *." *** POTENTIAL INCOMPATIBILITY *** This is likely to break interfaces that rely on the odd type handling behavior of typemaps in SWIG1.1--especially with respect to interfaces involving pass-by-value. 7/23/00 : beazley New %constant directive. This directive can be used to create true constants in the target scripting language. It's most simple form is something like this: %constant FOO 42; In this case, the type is inferred from the syntax of the value (in reality, all #define macros are translated into directives of this form). An expanded version is as follows: %constant(Foo *) FOO = &FooObj; In this case, an explicit type can be specified. This latter form may be useful for creating constants that used to be specified as const Foo *FOO = &FooObj; (which are now treated as variables). *** EXPERIMENTAL FEATURE *** The syntax may change in the final release. 7/23/00 : beazley Modified the parser so that variable declarations of the form "const type *a" are handled as variables, not constants. Note: SWIG1.1 handled this case erroneously because const char *a is a pointer variable that can be reassigned. *** POTENTIAL INCOMPATIBILITY *** Note: just because this is the "right" way to do things, doesn't mean it's the most appropriate interpretation. I suspect that many C programmers might use 'const char *' with the intent of creating a constant, without realizing that they've created a reassignable global variable. 7/23/00 : beazley The C/C++ wrapping layer has been completely redesigned and reimplemented. This change should iron out a few rough spots with the handling of datatypes. In addition, the wrapper code is somewhat cleaner. *** POTENTIAL INCOMPATIBILITY *** This change may break interfaces that involve subtle corner-cases with typemaps and the %addmethods directive since some of these features had somewhat type handling behavior in SWIG1.1. 7/23/00 : beazley The "memberin" and "memberout" typemaps are gone for the moment, but they might return as soon as I figure out how to integrate them with some of the streamlined C wrapper functions. *** POTENTIAL INCOMPATIBILITY *** 7/22/00 : beazley A variety of old type handling functions such as print_type(), print_full(), print_mangle(), etc... are gone and have been replaced with a smaller set of functions. See the file Doc/internals.html for details. This will break all third party language modules. *** POTENTIAL INCOMPATIBILITY *** 7/20/00 : beazley Deprecated the %val and %out directives. These directives shouldn't really be necessary since typemaps can be used to achieve similar results. This also cleans up the handling of types and parameters quite a bit. *** POTENTIAL INCOMPATIBILITY *** 7/20/00 : ttn Fixed unspecified-module bug in Guile support and removed more non-"with-smobs" functionality using patches submitted by Matthias Koeppe. Re-enable recognition of "-with-smobs" (with no effect since we use smobs by default now) for the time being. After the 1.3a4 release, this option will signal an error. 7/17/00 : ttn Fixed NULL-input bug in parameter list handling. Reported by Matthias Koeppe. 7/12/00 : beazley Fixed memory leak in Python type-checking code. Reported by Keith Davidson. Bug #109379. 7/10/00 : beazley Changed internal data structures related to function parameters. 7/10/00 : beazley Fixed some bugs related to the handling of the %name() directive and classes in the Tcl module. Problem reported by James Bailey. 7/10/00 : beazley Fixed parsing and enum handling problems with character constants. Reported by Greg Kochanski. 7/10/00 : beazley Removed WrapperFunction class from the core and updated the language module. This will break third party modules. *** POTENTIAL INCOMPATIBILITY *** 7/9/00 : beazley Implementation of SWIG no longer makes use of C++ operator overloading. This will almost certainly break *all* third party language modules that are not part of the main SWIG CVS tree. Sorry. *** POTENTIAL INCOMPATIBILITY *** 7/8/00 : beazley Removed the experimental and undocumented "build" typemap that was intended to work with multiple arguments. Simply too weird to keep around. Besides, a better replacement is in the works. 7/6/00 : ttn Removed non-"with-smobs" functionality (Guile support), i.e., "-with-smobs" is now the default and no longer needs to be specified on the command-line. 7/5/00 : ttn Incorporated Ruby support contributed by Masaki Fukushima. 6/28/00 : ttn Applied more-than-10-args bugfix patch contributed by Matthias Koeppe. 6/27/00 : beazley Rewrote some of the string handling and eliminated the C++ implementation (which is now just a wrapper). 6/27/00 : ttn Added Doc/index.html and Doc/internals.html. The target audience for the latter is new SWIG developers. Version 1.3 Alpha 3 (June 18, 2000) =================================== 6/18/00 : beazley Removed the naming.cxx, hash.cxx, and symbol.cxx files from the SWIG1.1 directory. Continued to migrate things away from the C++ base (although there's still a lot of work to do). 6/17/00 : beazley Added a few more examples to the Examples directory. Still need to do a lot of work on this. 6/16/00 : beazley Added -includeall to follow all #include statements in the preprocessor. 6/15/00 : beazley Tried to fix as many C++ warnings as possible when compiling with the Sun Workshop C++ compiler. Unfortunately, this means that there are a lot of statements that contain string literals of the form (char*)"Blah". 6/15/00: beazley A variety of cleanup and performance optimization in the low-level DOH library. This seems to result in a speedup of 50-100% for preprocessing and other related tasks. 5/10/00 : ttn Applied variable-wrapping bugfix patch contributed by Matthias Koeppe. 4/17/00 : ttn Updated MzScheme support contributed by Oleg Tolmatcev. We now use a `Scheme_Type'-based structure to wrap pointers. 4/11/00 : ttn Incorporated further Guile-support patch by Matthias Koeppe. Typemaps previously deleted have been re-added. There is now exception handling (see Doc/engineering.html). `SWIG_init' is now declared extern only for simple linkage. Some bugs were fixed. 4/06/00 : ttn Incorporated MzScheme support contributed by Oleg Tolmatcev. This includes new directories Lib/mzscheme and Examples/mzscheme. 4/03/00 : ttn Added Examples/guile and children. This is an adaptation of the same-named directory from the SWIG-1.1p5 distribution. Added Guile-specific section to Doc/engineering.html. 4/02/00 : ttn Incorporated new guilemain.i by Martin Froehlich. Incorporated Guile-support rewrite patch by Matthias Koeppe. The command line option "-with-smobs" enables implementation of pointer type handling using smobs, the canonical mechanism for defining new types in Guile. Previous implementation (using strings) is at the moment still supported but deprecated. At some point, "-with-smobs" will be the default and no longer required. 3/13/00 : beazley Added purify patches submitted by Ram Bhamidipaty. 3/02/00 : ttn Added support for different Guile "linkage" schemes. Currently, "-Linkage hobbit" works. Version 1.3 Alpha 2 (March 1, 2000) =================================== 2/29/00 : beazley Made SWIG ignore the 'mutable' keyword. 2/29/00 : beazley Incorporated some patches to the Perl5 module related to the -hide option and the destruction of objects. Patch submitted by Karl Forner. 2/27/00 : ttn Incorporated Guile support contributed by Matthias Koeppe. This includes a cpp macro in Lib/guile/guile.swg and the entire file Lib/guile/typemaps.i. 2/25/00 : ttn Modified configure.in and Makefile.in files to support non-local build (useful in multi-arch environments). 2/24/00 : ttn Incorporated Guile support contributed by Clark McGrew. This works with Guile 1.3, but since it depends heavily on the gh_ interface, it should work for all later versions. It has not been tested with versions before 1.3. WARNING: Code is unstable due to experimentation by ttn. 2/16/00 : beazley A variety of performance improvements to the Python shadow class code generation. Many of these result in substantial runtime performance gains. However, these have come at a cost of requiring the use of Python 1.5.2. For older versions, use 'swig -noopt -python' to turn off these optimization features. Version 1.3 Alpha 1 (February 11, 2000) ======================================= 2/11/00 : Added 'void' to prototype of Python module initializer. Reported by Mark Howson (1/20/00). 2/11/00 : beazley Modified the Python shadow class code to discard ownership of an object whenever it is assigned to a member of another object. This problem has been around for awhile, but was most recently reported by Burkhard Kloss (12/30/99). 2/11/00 : beazley Added braces around macros in the exception.i library. Reported by Buck Hodges (12/19/99) 2/11/00 : beazley Fixed bug in the constraints.i library. Reported by Buck Hodges (12/14/99) 2/11/00 : beazley The %native directive now generates Tcl8 object-style command calls. A full solution for Tcl7 and Tcl8 is still needed. Patch suggested by Mike Weiblen (11/29/99) 2/11/00 : beazley Modified the typemap code to include the $ndim variable for arrays. Patch provided by Michel Sanner (11/12/99). 2/11/00 : beazley Modified the Python module to raise a Runtime error if an attempt is made to set a read-only member of a shadow class. Reported by Michel Sanner (11/5/99). 2/10/00 : The documentation system has been removed. However, it is likely to return at some point in the future. 2/1/00 : Added a number of performance enhancements to the Python shadow classing and type-checking code. Contributed by Vadim Chugunov. 1. Remove _kwargs argument from the shadow wrappers when -keyword option is not specified. This saves us a construction of keyword dictionary on each method call. def method1(self, *_args, **_kwargs): val = apply(test2c.PyClass1_method1, (self,) + _args, _kwargs) return val becomes def method1(self, *_args): val = apply(test2c.PyClass1_method1, (self,) + _args) return val 2. Incorporate self into the _args tuple. This saves at least one tuple allocation per method call. def method1(self, *_args): val = apply(test2c.PyClass1_method1, (self,) + _args) return val becomes def method1(*_args): val = apply(test2c.PyClass1_method1, _args) return val 3. Remove *Ptr classes. Assume that we are SWIGging a c++ class CppClass. Currently SWIG will generate both CppClassPtr class that hosts all methods and also CppClass that is derived from the former and contains just the constructor. When CppClass method is called, the interpreter will try to find it in the CppClass's dictionary first, and only then check the base class. CppClassPtr functionality may be emulated with: import new _new_instance = new.instance def CppClassPtr(this): return _new_instance(CppClass, {"this":this,"thisown":0}) This saves us one dictionary lookup per call. The new module was first added in Python-1.5.2 so it won't work with older versions. I've implemented an alternative that achieves the same thing 4. Use CObjects instead of strings for pointers. Dave: This enhancements result in speedups of up to 50% in some of the preliminary tests I ran. 2/1/00 : Upgraded the Python module to use a new type-checking scheme that is more memory efficient, provides better performance, and is less error prone. Unfortunately, it will break all code that depends on the SWIG_GetPtr() function call in typemaps. These functions should be changed as follows: if (SWIG_GetPtr(string,&ptr,"_Foo_p")) { return NULL; } becomes if (SWIG_ConvertPtr(pyobj, &ptr, SWIG_TYPE_Foo_p) == -1) { return NULL; } Note: In the new implementation SWIG_TYPE_Foo_p is no longer a type-signature string, but rather an index into a type encoding table that contains type information. *** POTENTIAL INCOMPATIBILITY *** 1/30/00 : loic Conditionally compile experimental code with --enable-experiment configure flag. Fix .cvsignore to ignore configure & yacc generated files 1/28/00 : loic Apply automake everywhere Keep configure scripts so that people are not *forced* to autoconf Keep sources generated by yacc so that compilation without yacc is possible. Source/LParse/cscanner.c: change lyacc.h into parser.h to please default yacc generation rules. Use AC_CONFIG_SUBDIRS in configure.in instead of hand made script. Update all relevant .cvsignore to include .deps Fixed missing ; line 136 Source/Swig/swig.h 1/13/00 : beazley Fixed a number of minor end-of-file parsing problems in the preprocessor. 1/13/00 : beazley Added -freeze option that forces SWIG to freeze upon exit. This is only used as a debugging tool so that I can more easily examine SWIG's memory footprint. 1/13/00 : beazley Added patch to guile module for supporting optional arguments Patch contributed by Dieter Baron. 1/13/00 : loic Added .cvsignore, Examples/.cvsignore, Source/DOH/Doh/.cvsignore Source/SWIG1.1/main.cxx: Fixed -I handling bug Source/Modules1.1/java.cxx: fixed char* -> const char* warnings that are errors when compiling with gcc-2.95.2 Source/SWIG1.1/main.cxx: cast const char* to char* for String_replace token and rep should really be const. 1/12/00 : beazley Added Harco's Java modules. 1/12/00 : beazley Revoked the %ifdef, %ifndef, %endif, %if, %elif, and %else directives. These are no longer needed as SWIG now has a real preprocessor. *** POTENTIAL INCOMPATIBILITY *** 1/12/00 : beazley Moved the documentation modules from the SWIG directory to the Modules directory (where they really should have been to begin with). 1/12/00 : beazley Removed the -stat option for printing statistics. The statistics reporting was inadequate and mostly broken anyway. *** POTENTIAL INCOMPATIBILITY *** 1/12/00 : beazley Removed the -t option for reading a typemap file. More trouble than it's worth. Just include typemaps at the top of the interface file. *** POTENTIAL INCOMPATIBILITY *** 1/12/00 : beazley Removed the %checkout directive. *** POTENTIAL INCOMPATIBILITY *** 1/12/00 : beazley Removed the -ci option for file checkin. Too problematic to implement. Probably better to just put your SWIG library under CVS instead. *** POTENTIAL INCOMPATIBILITY ***. 1/11/00 : beazley Deleted the LATEX module. Sorry... Didn't know anyone who was using it. Besides, I'm looking to simplify the documentation system. *** POTENTIAL INCOMPATIBILITY *** 1/11/00 : beazley Modified the ASCII documentation module to use a .txt suffix for its output file instead of .doc. 1/11/00 : beazley Added the long-lost SWIG preprocessor back to the system. It should be enabled by default. Raw preprocessed output can be viewed using swig -E file.i. *** NEW FEATURE *** 1/11/00 : beazley and djmitche Completely reorganized the SWIG directory structure. The basic organization is now: Source/ SWIG source code Lib/ SWIG library files (swig_lib) Doc/ Documentation Examples/ Examples More directories will be added as needed. 12/08/99: Loic Dachary (loic@senga.org) Enhanced package handling for perl5 and c++. With new option -hide Foo::Bar, every perl5 object (Frob) is qualified by Foo::Bar::Frob. The package name is solely used to encapsulate C/C++ wrappers output in _wrap.c and the corresponding perl package in .pm. Note that a package name may contain :: (Frob::Nitz) and will be relative to the package name provided by -hide (Foo::Bar::Frob::Nitz). In *_wrap.c, SWIG_init macro is used. Was previously defined but not used and simplifies code. Added typemap(perl5,perl5in) and typemap(perl5,perl5out) that do the equivalent of typemap(perl5,in) and typemap(perl5,out) but contain perl code and applies to wrappers generated by -shadow. Lacking proper regression tests I used Examples/perl5/{c++,constraint,defarg,except, graph/graph[1234],multinherit,nested,shadow,simple,tree, typemaps/{argv,argv2,arraymember,database,file,ignore,integer, output,passref,reference,return}}/. I ran swig with and without the patches, diff the generatedsources, run the .pl files and checked that the results are identical. In all those examples I had no error. 11/21/99: Modified the Tcl module to provide full variable linking capabilities to all datatypes. In previous versions, a pair of accessor functions were created for datatypes incompatible with the Tcl_LinkVar() function. Now, we simply use variable traces to support everything. This may break scripts that rely upon the older behavior. *** POTENTIAL INCOMPATIBILITY *** 11/21/99: Added slight tweak to wrapper generator to collect local variables of similar type. Produces somewhat more compact wrapper code. 11/20/99: Modified the Tcl module to use SWIG_GetArgs() to parse arguments. This is a technique borrowed from Python in which arguments are converted using a format string convention similiar to fprintf(). This results in a *substantial* reduction in the size of the resulting wrapper code with only a modest runtime overhead in going through the extra conversion function. 11/13/99: Completely rewrote the class/structure generation code for the Tcl module. Now, a small set of runtime functions are used to implement the functionality for all classes (instead of a massive amount of runtime code being generated for each class). Class specific information is simply encoded in a series of static tables. This results in a *HUGE* reduction in wrapper code size--especially for C++. 11/13/99: Removed the -tcl (Tcl 7.x) module. Tcl 8.0 is now several years old and the defacto standard--no real reason to keep supporting the old version at this point. 11/13/99: Cleaned up -c option for Python module. The pyexp.swg file is now gone. 11/13/99: Fixed external declarations to work better with static linking on Windows. Static linking should now be possible by defining the -DSTATIC_LINK option on the command line. Patch contributed by Alberto Fonseca. 11/5/99 : Fixed an obscure code generation bug related to the generation of default constructors. Bug reported by Brad Clements. 11/5/99 : Fixed a few memory problems found by purify. 11/5/99 : Officially deprecated the -htcl, -htk, and -plugin options from the Tcl and Tcl8 modules. 10/26/99: Removed unused variable from python/typemaps.i. Patch contributed by Keith Davidson. 8/16/99 : Added _WIN32 symbol to libraries to better support Windows. 8/16/99 : Deprecated the Perl4 module. It is no longer included in the distribution and no longer supported. In the entire 3 years SWIG has been around I never received a single comment about it so I'm assuming no one will miss it... 8/16/99 : Modified the type-checking code to register type mappings using a table instead of repeated calls to SWIG_RegisterMapping(). This reduces the size of the module initialization function somewhat. 8/15/99 : Cleaned up the pointer type-checking code in the Tcl module. 8/15/99 : Many changes to the libraries to support runtime libraries. 8/13/99 : Eliminated C++ compiler warning messages about extern "C" linkage. 8/13/99 : Some cleanup of Python .swg files to better support runtime libraries on Windows. 8/13/99 : Modified the %pragma directive to attach pragmas declared inside a class definition to the class itself. For example: class foo { ... %pragma(python) addtomethod = "insert:print `hello world'" ... } Most people don't need to worry about how this works. For people writing backend modules, class-based pragmas work like this: lang->cpp_open_class() // Open a class lang->cpp_pragma() // Supply pragmas ... // Emit members lang->cpp_close_class() // Close the class All of the pragmas are passed first since they might be used to affect the code generation of other members. Please see the Python module for an example. Patches contributed by Robin Dunn. 8/13/99 : Patch to Python shadow classes to eliminate ignored exception errors in destructors. Patch contributed by Robin Dunn. 8/11/99 : Minor patch to swig_lib/python/swigptr.swg (added SWIGSTATIC declaration). Patch contributed by Lyle Johnson. 8/11/99 : Added FIRSTKEY/NEXTKEY methods to Perl5 shadow classes Patch contributed by Dennis Marsa. 8/11/99 : Modified Python module so that NULL pointers are returned and passed as 'None.' Patch contributed by Tal Shalif. 8/10/99 : Fixed missing 'int' specifiers in various places. 8/10/99 : Added Windows makefile for Runtime libraries. Contributed by Bob Techentin. 8/10/99 : Fixed minor problem in Python runtime makefile introduced by keyword arguments. 8/8/99 : Changed $target of perl5(out) typemap from ST(0) to ST(argvi). Patch contributed by Geoffrey Hort. 8/8/99 : Fixed bug in typemap checking related to the ANY keyword in arrays and ignored arguments. Error reported by Geoffrey Hort. 8/8/99 : %enabledoc and %disabledoc directives can now be used inside class/structure definitions. However, no check is made to see if they are balanced (i.e., a %disabledoc directive inside a class does not have to have a matching %enabledoc in the same class). 8/8/99 : Keyword argument handling is now supported in the Python module. For example: int foo(char *bar, int spam, double x); Can be called from Python as foo(x = 3.4, bar="hello", spam=42) To enable this feature, run SWIG with the '-keyword' command line option. Mixing keyword and default arguments should work as well. Unnamed arguments are assigned names such as "arg1", "arg2", etc... *** POTENTIAL INCOMPATIBILITY *** Functions with duplicate argument names such as bar(int *OUTPUT, int *OUTPUT) will likely cause problematic wrapper code to be generated. To fix this, use different names or use %apply to map typemaps to alternate names. 8/8/99 : Handling of the 'this' pointer has been changed in Python shadow classes. Previously, dereferencing of '.this' occurred in the Python shadow class itself. Now, this step occurs in the C wrappers using the following function: SWIG_GetPtrObj(PyObject *, void **ptr, char *type) This function can accept either a string containing a pointer or a shadow class instance with a '.this' attribute of appropriate type. This change allows the following: 1. The real shadow class instance for an object is passed to the C wrappers where it can be examined/modified by typemaps. 2. Handling of default/keyword arguments is now greatly simplified. 3. The Python wrapper code is much more simple. Plus, it eliminated more than 300 lines of C++ code in the Python module. *** CAVEAT : This requires the abstract object interface. It should work with Python 1.4, but probably nothing older than that. 8/8/99 : Fixed handling of "const" and pointers in classes. In particular, declarations such as class foo { ... const char *msg; const int *iptr; } are handled as assignable variables as opposed to constant values (this is the correct behavior in C/C++). Note: declarations such as "char *const msg" are still unsupported. Constants declared at the global level using const are also broken (because I have a number of interfaces that rely upon this behavior). *** POTENTIAL INCOMPATIBILITY *** This may break interfaces that mistakenly treat 'const char *' types as constant values. 8/8/99 : Modified the parser to support bit-fields. For example: typedef struct { unsigned int is_keyword : 1; unsigned int is_extern : 1; unsigned int is_static : 1; } flags; Bit-fields can only be applied to integer types and their are other restrictions. SWIG performs no such type-checking (although the C compiler will catch problems when it tries to compile the wrapper code). 8/8/99 : Removed trailing space of $basetype substitution in typemaps. This is to allow things like this: %typemap(python, argout) spam** OUTPUT{ ... char* a = "$basetype_p"; ... } (Patch suggested by Nathan Dunfield). 6/22/99 : Made a very slight tweak to the Perl5 shadow class code that allows typemaps to alter the return type of objects (to support polymorphic types). Patch contributed by Drake Diedrich. 4/8/99 : Fixed null pointer handling bug in Perl module. Patch contributed by Junio Hamano. 3/17/99 : Fixed bug in perl5ptr.swg for ActiveState Perl. Patch contributed by Greg Anderson. 2/27/99 : Eliminated segmentation fault when Swig runs on empty files. 2/27/99 : Added patch to Guile module to eliminate unused variables. Contributed by Mike Simons. 2/27/99 : Fixed problem with %addmethods returning references. 2/27/99 : Fixed Runtime/Makefile. Patch contributed by Mike Romberg. 2/27/99 : Incorporated patches to the type-checker. 2/27/99 : Fixed problem with -exportall switch and shadow classes in Perl5 module. Patch contributed by Dennis Marsa. 2/27/99 : Modified Perl5 module to recognize 'undef' as a NULL char *. Patch contributed by Junio Hamano. 2/27/99 : Fixed the Perl5 module to support the newer versions of ActiveState Perl for Win32. 2/27/99 : Fixed the include order of files specified with the -I option. 2/5/98- : Dave finishes his dissertation, goes job hunting, moves to 2/5/99 Chicago and generally thrashes about. Version 1.1 Patch 5 (February 5, 1998) ====================================== 2/4/98 : Fixed a bug in the configure script when different package locations are specified (--with-tclincl, etc...). 2/2/98 : Fixed name-clash bug related to the switch to C macros for accessor functions. The new scheme did not work correctly for objects with members such as 'obj', 'val', etc... Fixed the bug by appending the word 'swig' to macro argument names. Patch contributed by Rudy Albachten. 2/2/98 : Slight fix to the Perl5 module to eliminate warning messages about 'varname used only once : possible typo'. Fix contributed by Rudy Albachten. 1/9/98 : Fixed a bug in the Perl 5 module related to the creation of constants and shadow classes. 1/9/98 : Fixed linking bug with Python 1.5 embed.i library file. Version 1.1 Patch 4 (January 4, 1998) ===================================== 1/4/98 : Changed structured of the Examples directory to be more friendly to Borland C++. 1/4/98 : Added the function Makefile.win.bc for compiling the examples under Borland 5.2. 1/4/98 : Slight change to the perl5 module and C++ compilation. The library is now included before any Perl headers because Perl the extern "C" linkage of math.h screws alot of things up (especially on Windows). 1/2/98 : Change to the Python module that reduces the number of constants created by C++ classes, inheritance, and shadow classes. This modification may introduce a few slight incompatibilities if you attempt to use the non-shadow class interface with shadow classes enabled. Patch contributed by Mike Romberg. 1/2/98 : Support for Tcl 8.0 namespaces has been added. This *replaces* the original SWIG mechanism that assumed [incr Tcl] namespaces. To use namespaces, simply run SWIG with the following options swig -tcl -namespace foo.i This places everything in a namespace that matches the module name swig -tcl -namespace -prefix bar foo.i This places everything in the namespace 'bar' The use of namespaces is new in Tcl 8.0. However, the wrapper code generated by SWIG will still work with all versions of Tcl newer than and including Tcl 7.3/Tk3.6 even if the -namespace option is used. *** POTENTIAL INCOMPATIBILITY *** This change may break existing applications that relied on the -prefix and -namespace options. 1/2/98 : Added the following constants to the Tcl wrapper code SWIG_name - Name of the SWIG module SWIG_prefix - Prefix/namespace appended to command names SWIG_namespace - Name of the namespace SWIG library writers can use these to their advantages. 1/2/98 : Fixed a bug in the Tcl8 module related to the creation of pointer constants (the function SWIG_MakePtr was missing from the wrapper code). 1/2/98 : Added the consthash.i library file to the Tcl and Tcl8 modules. 1/1/98 : Changed and cleaned up the Python typemaps.i file. The following significant changes were made : 1. The OUTPUT typemap now returns Python tuples instead of lists. Lists can be returned as before by using the L_OUTPUT type. If compatibility with older versions is needed, run SWIG with the -DOUTPUT_LIST option. 2. The BOTH typemap has been renamed to INOUT. For backwards compatibility, the "BOTH" method still exists however. 3. Output typemaps now generate less code than before. Changes to typemaps.i may break existing Python scripts that assume output in the form of a list. *** POTENTIAL INCOMPATIBILITY *** 12/31/97: Fixed long overdue problems with the testing scripts and certain makefiles that required the use of the bash shell. Everything should work properly with the standard Bourne shell (sh) now. 12/31/97: Modified typemaps to allow $basetype as a valid local variable. This allows for all sorts of bizarre hackish typemaps that do cool things. Patch contributed by Dominique Dumont. 12/31/97: Switched accessor functions generated for member data to C preprocessor macros (except in cases involving typemaps or char *). 12/31/97: Fixed a bug related to C++ member data involving references. 12/31/97: Changed accessor functions for C++ member functions to preprocessor macros. This cleans up the wrapper code and results in fewer function definitions. 12/31/97: Changed the default C constructor to use calloc() instead of malloc() 12/30/97: Changed the creation of constants in the Perl5 module. For all practical purposes, they should work in exactly the same way as before except that they now require much less wrapper code. Modules containing large numbers of constants may see greater than a 50% reduction in wrapper code size. 12/30/97: Modified the Python module to be more intelligent about the creation of constants. SWIG no longer generates redundant global variables and the size of the module initialization function should be reduced. (Many thanks to Jim Fulton). 12/29/97: Fixed a bug in C++ code generation related to member functions, default arguments, and references. 12/29/97: Fixed configure script and a few makefiles to support Python 1.5 12/29/97: Added 'embed15.i' library file. This file should be used to statically link versions of Python 1.5. To make it the default, simply copy 'swig_lib/python/embed15.i' to 'swig_lib/python/embed.i' Version 1.1 Patch 3 (November 24, 1997) ======================================== 11/23/97: Fixed a bug in the Perl5 module with shadow classes and static class functions that return class instances. Note : The fix for this bug requires a slight restructuring of of the .pm files created by SWIG. 11/23/97: Fixed a bug in the Tcl/Tcl8 modules related to variable linking of character arrays. If you declared a global variable 'char foo[10]', the generated wrapper code would either cause a segmentation fault immediately upon loading or weird memory corruption elsewhere. This should now be fixed although character arrays can only be read-only. 11/23/97: Fixed a bug with the %import directive that caused it to fail if files were imported from directories other than the current working directory. 11/23/97: Fixed incorrect diagnostic message in the ASCII documentation module. 11/23/97: Changed the behavior of the -o option when used with shadow classes. If -o was used to specify both the pathname and filename of SWIG's output such as swig -o /home/swig/wrapper.c -shadow -perl5 foo.i The wrapper code would be placed the file specified with -o, but the .pm file and documentation would be placed in the directory where SWIG was run. Now, these files are placed in the same directory as the file specified with the -o option. This change is also needed for proper operation on the Macintosh. 11/23/97: Added a 'this()' method to Perl5 shadow classes. This can be used to return the normal pointer value from a shadow class that is represented as a tied hash. To use just invoke as a method like this : $l = new List; # Create an object $ptr = $l->this(); # Get the normal pointer value *** NEW FEATURE *** 11/23/97: Fixed the Tcl 8 pointer.i library file (which was completely broken in 1.1p2). 11/23/97: Modified the Perl5 type-checker to fix a few problems with global variables of pointer types and to allow tied hashes to be used interchangably with normal pointer values. 11/23/97: Modified the typemap mechanism to allow output typemaps of type 'void'. These were ignored previously, but now if you specify, %typemap(lang,out) void { ... return a void ... } You can change or assign a return value to the function. 11/23/97: Fixed processing of 'bool' datatypes in the Python module. 11/23/97: Fixed minor parsing error with C++ initializers. For example, class B : public A { public: B() : A() { ... }; ... } 11/23/97: Fixed the Tcl8 module so that C functions that call back into Tcl don't corrupt the return result object (SWIG was gathering the result object too early which leads to problems if subsequent Tcl calls are made). 11/23/97: Fixed a code generation bug in the Python module when two or more output parameters were used as the first arguments of a function. For example : %include typemaps.i void foo(double *OUTPUT, double *OUTPUT, double a); Previously, doing this resulted in the creation of an extraneous comma in the output, resulting in a C syntax error. 11/22/97: Fixed a bug when template handling that was stripping whitespace around nested templates. For example : Foo > was getting munged into Foo> which is a syntax error in in the C++ compiler. 11/22/97: Fixed bugs in the Borland C++ makefiles. 11/22/97: Fixed memory corruption bug when processing integer arguments in Tcl8 module. 11/21/97: Fixed a bug in the Runtime/Makefile related to Tcl 8. 11/21/97: Fixed a bug with the %new directive and Perl5 shadow classes. No longer generates a perl syntax error. 11/9/97 : Changed a strncpy() to strcpy() in the pointer type-checker. This results in a substantial performance improvement in type-checking. 10/29/97: Fixed a bug in the code generation of default arguments and user-defined types. For example : void foo(Vector a, Vector b = d); should now work properly. Version 1.1 Patch 2 (September 4, 1997) ======================================= 9/4/97 : Fixed problem with handling of virtual functions that was introduced by some changes in the C++ module. Version 1.1 Patch 1 (August 27, 1997) ===================================== 8/26/97 : Fixed compilation and run-time bugs with Tcl 8.0 final. 8/21/97 : Fixed code generation bug with arrays appearing as arguments to C++ member functions. For example : class Foo { public: void Bar(int a[20][20]); }; There is still a bug using arrays with added methods however. 8/20/97 : Fixed a bug with generating the code for added methods involving pass-by-value. 8/19/97 : Modified the typemapper to substitute the '$arg' value when declaring local variables. For example : %typemap(in) double * (double temp_$arg) { ... do something ... } When applied to a real function such as the following : void foo(double *a, double *b, double *result); three local variables will be created as follows : double temp_a; double temp_b; double temp_result; This can be used when writing multiple typemaps that need to access the same local variables. 7/27/97 : Fixed a variety of problems with the %apply directive and arrays. The following types of declarations should now work : %apply double [ANY] { Real [ANY] }; %apply double [4] { double [10] }; A generic version of apply like this : %apply double { Real }; should now work--even if arrays involving doubles and Reals are used later. 7/27/97 : Changed warning message about "Array X has been converted to Y" to only appear if running SWIG in verbose mode. 7/27/97 : Added the variables $parmname and $basemangle to the typemap generator. $parmname is the name of the parameter used when the typemap was matched. It may be "" if no parameter was used. $basemangle is a mangled version of the base datatype. Sometimes used for array handling. 7/27/97 : Changed the behavior of output arguments with Python shadow classes. Originally, if a function returned an object 'Foo', the shadow class mechanism would create code like this : def return_foo(): val = FooPtr(shadowc.return_foo()) val.this = 1 return val The problem with this is that typemaps allow a user to redefine the output behavior of a function--as a result, we can no longer make any assumptions about the return type being a pointer or even being a single value for that matter (it could be a list, tuple, etc...). If SWIG detects the use of output typemaps (either "out" or "argout") it returns the result unmodified like this : def return_foo(): val = shadowc.return_foo() return val In this case, it is up to the user to figure out what to do with the return value (including the possibility of converting it into a Python class). 7/26/97 : Fixed a parsing problem with types like 'unsigned long int', 'unsigned short int', etc... 7/24/97 : Minor bug fix to Tcl 8 module to parse enums properly. Also fixed a memory corruption problem in the type-checker. (patch contributed by Henry Rowley. 7/24/97 : Added Python-tuple typemaps contributed by Robin Dunn. 7/24/97 : Incorporated some changes to the Python module in support of Mark Hammond's COM support. I'm not entirely sure they work yet however. Needs documentation and testing. 7/24/97 : Fixed code generation bugs when structures had array members and typemaps were used. For example : %typemap(memberin) double [20][20] { ... get a double [20][20] ... } struct Foo { double a[20][20]; } Originally, this would generate a compiler-type error when the wrapper code was compiled. Now, a helper function like this is generated : double *Foo_a_set(Foo *a, double val[20][20]) { ... memberin typemap here ... return (double *) val; } When writing typemaps, one can assume that the source variable is an array of the *same* type as the structure member. This may break some codes that managed to work around the array bug. *** POTENTIAL INCOMPATIBILITY *** 7/13/97 : Fixed bug in Perl5 module when using C global variables that are pointers. When used in function calls and other operations, the value of the pointer would be invalid---causing core dumps and other problems. SWIG implements global variables using Perl magic variables. As it turns out, the error was caused by the fact that the pointer-extraction code was somehow bypassing the procedure used to resolve magical variables (hence, leaving the value undefined). To fix the problem, SWIG now explicitly resolves magic before extracting pointer values. 7/12/97 : Eliminated the last remnants of free() and malloc() from the SWIG compiler. 7/12/97 : Fixed parsing problems with typemaps involving arrays and temporary variables of arrays. Also made it possible for SWIG to handle typemaps like this : %typemap(in) double [ANY] (double temp[$dim0]) { ... store data in temp[$dim0] ... } Not only does this typemap match any double [] array, it creates a local variable with precisely the right dimensions. (ie. $dim0 gets filled in with the real number of dimensions). Of course, off the record, this will be a way to add more functionality to the typemaps.i libraries. 7/9/97 : Fixed some problems with Perl5, static linking, and shadow classes. When statically linking multiple modules together, write a top-level interface file like this when shadow classes are not used : %module swig, foo, bar, glob; %include perlmain.i When shadow classes are used, the module names have an extra 'c' appended so it should read as : %module swig, fooc, barc, globc; %include perlmain.i When linking multiple modules, consider using the SWIG runtime library. 7/8/97 : Incorporated fixed versions of the Borland C++ Makefiles. 7/8/97 : First cut at trying to eliminate excessive compiler warnings. As it turns out, alot of warnings go away if you just make declarations like this clientData = clientData; in the resulting wrapper code. Most compilers should just ignore this code (at least would can hope). 7/8/97 : Fixed bizarre code generation bug with typemaps and C++ classes. In some cases, typemaps containing printf formatting strings such as %typemap(memberout) int * { printf("%d",42); } Would generate completely bogus code with garbage replacing the '%d'. Caused by one faulty use of printf (wasn't able to find any other occurrences). 7/7/97 : Fixed bug in Python shadow class generation with non-member functions that are returning more than one value. 7/7/97 : Incorporated modifications to make SWIG work with Guile 1.2. Still need to test it out, but it is rumored to work. 7/2/97 : Fixed some bugs related to output arguments and Python shadow classes. If an output argument is detected, SWIG assumes that the result is a list and handles it appropriately. If the normal return type of an function is an object, it will be converted into a shadow class as before, but with the assumption that it is the first element of a list. *** NOTE : This behavior has been subsequently changed *** 6/29/97 : Changed EXPORT to SWIGEXPORT in all of the language modules. Should provide better compatibility with Windows. 6/29/97 : Modified Python shadow classes so that output arguments work correctly (when typemaps are used). Version 1.1 (June 24, 1997) =========================== 6/24/97 : Fixed Objective-C constructor bug when working with Perl5 shadow classes. 6/23/97 : Fixed some parsing problems with Objective-C. Declarations such as the following should work now : - foo : (int) a with: (int) b; 6/22/97 : Added SWIG Runtime library. This library contains the SWIG pointer type-checker and support functions that are normally included in every module. By using the library, it is easier to work with multiple SWIG generated modules. 6/22/97 : Fixed minor bug in Perl5 module related to static linking of multiple modules. 6/22/97 : Fixed some bugs with the %import directive. When used with Perl5 shadow classes, this generates a 'require' statement to load in external modules. 6/22/97 : Added -swiglib option. This prints out the location of the SWIG library and exits. This option is only really useful to configuration tools that are looking for SWIG and its library location (e.g. autoconf, configure, etc...). 6/21/97 : Fixed export bug with Perl5.004 on Windows-NT. 6/20/97 : Minor change to code generation of class/structure members in order to work better with typemaps. Should have no noticable impact on existing SWIG modules. 6/19/97 : Added -t option. This allows SWIG to load a typemap file before processing any declarations. For example : swig -t typemaps.i -python example.i At most, only one typemap file can be specified in this manner. *** NEW FEATURE *** 6/18/97 : Need a Makefile fast? Type swig [-tcl, -perl5, -python] -co Makefile and you will get a Makefile specific to that target language. You just need to modify it for your application and you're ready to run. 6/18/97 : Completed the -ci option. This option checks a file into the SWIG library. It should be used in conjunction with a language option. For example : swig -tcl -ci foobar.i Checks the file foobar.i into the Tcl part of the library. In order to check a file into the general library (accessible to all languages modules), do the following swig -ci -o ../foobar.i foobar.i (Admittedly this looks a little strange but is unavoidable). The check-in option is primarily designed for SWIG maintenance and library development. The command will fail if the user does not have write permission to the SWIG library. Third party library extensions can easily install themselves by simply providing a shell script that uses 'swig -ci' to install the appropriate library files. It is not necessary to know where the SWIG library is located if you use this mechanism. *** NEW FEATURE *** 6/16/97 : Fixed a bug in shadow class generation when %name() was applied to a class definition. Unfortunately, fixing the bug required a change in the Language C API by adding an extra argument to the Language::cpp_class_decl() function. This may break SWIG C++ extensions. *** POTENTIAL INCOMPATIBILITY *** 6/15/97 : Added a warning message if no module name is specified with the %module directive or -module option. 6/15/97 : Fixed line number bug when reporting errors for undefined base classes. 6/15/97 : Added new %rename directive. This allows the forward declaration of a renaming. For example : %rename OldName NewName; .... later ... int OldName(int); Unlike %name, %rename will rename any occurrence of the old name. This applies to functions, variables, class members and so forth. There is no way to disable %rename once set, but you can change the name by redeclaring it to something else. *** NEW FEATURE *** 6/15/97 : Improved the implementation of the %name directive so that it could be used with conditional compilation : #ifdef SWIG %name(NewName) #endif int OldName(int); 6/15/97 : Added support for functions with no return datatype. In this case, SWIG assumes a return type of 'int'. 6/11/97 : Improved error reporting in the parser. It should be a little less sensitive to errors that occur inside class definitions now. Also reports errors for function pointers. 6/11/97 : Made '$' a legal symbol in identifiers. This is to support some Objective-C libraries. Some compilers (such as gcc) may also allow identifiers to contain a $ in C/C++ code as well (this is an obscure feature of C). When '$' appears in identifier, SWIG remaps it to the string '_S_' when creating the scripting language function. Thus a function 'foo$bar' would be called 'foo_S_bar'. 6/11/97 : Fixed bug in Python shadow classes with __repr__ method. If supplied by the user, it was ignored, but now it should work. 6/9/97 : Fixed the Tcl 8.0 module to work with Tcl 8.0b1. SWIG is no longer compatible with *any* alpha release of Tcl 8.0. *** POTENTIAL INCOMPATIBILITY *** 6/7/97 : Put a maximal error count in (currently set to 20). SWIG will bail out if it generates more errors than this (useful for preventing SWIG from printing 4000 syntax errors when it gets confused). 6/7/97 : Fixed segmentation fault when parsing variable length arguments. 6/7/97 : Minor change to Perl5 module. C++ static functions are now put in the same package as their class when using shadow classes. 6/7/97 : Centralized the naming of functions, members, wrappers etc... By centralizing the naming scheme, it should be possible to make some multi-file optimizations. Also, it should be possible to change SWIG's naming scheme (perhaps a new feature to be added later). 6/2/97 : Added 'arginit' typemap. This can be used to assign initial values to function arguments. Doing so makes it somewhat easier to detect improper argument passing when working with other typemaps. 6/2/97 : Fixed code generation bug when read-only variables were inherited into other classes. Under inheritance, the variables would become writable, but this has now been corrected. 5/30/97 : An empty %name() directive is no longer allowed or supported. This directive was originally used to strip the prefix off of a class or structure. Unfortunately, this never really seemed to work right and it complicated the C++ code generator significantly. As far as I can tell no one uses it, so it is now history. *** POTENTIAL INCOMPATIBILITY *** 5/28/97 : Fixed a parsing bug with #define and C++ comments. Declarations such as the following now work properly : #define CONST 4 // A Comment 5/28/97 : Made some performance improvements to the SWIG String class. (only affects the SWIG compiler itself). 5/28/97 : Modified the parser to skip template definitions and issue a warning message. 5/28/97 : Preliminary support for parameterized types added (ie. templates). Types such as the following should pass through the SWIG compiler void foo(vector *a, vector *b); When used, the entire name 'vector' becomes the name of the datatype. Due to space limitations in datatype representations, the name should not exceed 96 characters. Note : This is only part of what is needed for template support. Template class definitions are not yet supported by SWIG. The template notation above may also be used when specifying Objective-C protocol lists. *** NEW FEATURE *** 5/24/97 : First cut at Objective-C support added. As it turns out, almost everything can be handled with only a few minor modifications to the C++ module. *** NEW FEATURE *** 5/23/97 : Fixed repeated definition bug in multiple inheritance handling when multiple base classes share a common base class (ie. the evil diamond). 5/21/97 : Fixed rather embarrassing typo that worked its way into the Tests/Build directory. 5/19/97 : Fixed code generation bug when using native methods and shadow classes with Python and Perl5 modules. 5/19/97 : Modified the %apply directive slightly so that it would work with pointers a little better. For example : %apply unsigned long { DWORD }; Applies *all* typemaps associated with "unsigned long" to "DWORD". This now includes pointers to the two datatypes. For example, a typemap applied to "unsigned long **" would also be applied to any occurrence of "DWORD **" as well. 5/19/97 : Fixed an ownership assignment bug in the Perl5 module when class members were returning new objects belonging to different classes. 5/17/97 : Added a few more typemap variables. $name - Name of function/variable/member $basetype - Base datatype (type without pointers) $argnum - Argument number 5/16/97 : Fixed embarrassing underscore error in local variable allocator. 5/16/97 : Fixed namespace clash bug in parameterized typemaps when creating arrays as new local variables. 5/15/97 : Fixed some bugs with inheritance of added methods across multiple files. SWIG now uses names of base classes when generating such functions. 5/14/97 : Finished support for default typemaps. Primarily used internally, they can be used to match the basic built-in datatypes used inside of SWIG. You can specify them in interface files as well like this : %typemap(tcl,in) int SWIG_DEFAULT_TYPE { $target = atoi($target); } Unlike normal typemaps, this default map will get applied to *all* integer datatypes encountered, including those renamed with typedef, etc... 5/13/97 : Fixed substring bug in type checker. 5/12/97 : Fixed bug in parameterized typemaps when declaring local variables of structures. Version 1.1 Beta6 (May 9, 1997) =============================== 5/9/97 : Fixed bizarre NULL pointer handling bug in Perl5 module. 5/8/97 : Fixed mysterious segmentation fault when running SWIG on an empty file. 5/7/97 : The code generator will now replace the special symbol "$cleanup" with the cleanup code specified with the "freearg" typemap. This change needed to properly manage memory and exceptions. 5/5/97 : Added the 'typemaps.i' library file. This contains a variety of common typemaps for input values, pointers, and so on. 5/5/97 : Changed behavior of "argout" typemap in Python module. Old versions automatically turned the result into a Python list. The new version does nothing, leaving the implementation up to the user. This provides more flexibility but may break older codes that rely on typemaps. *** POTENTIAL INCOMPATIBILITY *** 5/5/97 : Fixed bug in Python module related to the interaction of "argout" and "ignore" typemaps. 5/5/97 : Fixed bug in Python module that would generate incorrect code if all function arguments are "ignored". 5/4/97 : Added %apply and %clear directives. These form a higher level interface to the typemap mechanism. In a nutshell, they can be used to change the processing of various datatypes without ever having to write a typemap. See the SWIG documentation for more details. ** NEW FEATURE ** 5/4/97 : Added a local variable extension to the typemap handler. For example : %typemap(tcl,in) double *(double temp) { temp = atof($source); $target = &temp; } In this case, 'temp' is a local variable that exists in the entire wrapper function (not just the typemap code). This mechanism provides better support for certain types of argument handling and also makes it possible to write thread-safe typemaps. Any number local variables can be declared by supplying a comma separated list. Local variables are guaranteed to be unique, even if the same typemap is applied many times in a given function. ** Not currently supported in Perl4 or Guile modules. 5/2/97 : Fixed processing of %ifdef, %endif, %if, etc... (These are SWIG equivalents of the C preprocessor directives that can pass through the C preprocessor without modification). 5/2/97 : Fixed major (but subtle) bug in the run-time type checker related to searching and type-checking for C++ inheritance. To make a long story short, if you had two classes named "Foo" and "FooObject" the type checker would sometimes get confused and be unable to locate "Foo" in an internal table. 5/2/97 : Fixed some bugs in the -co option. 4/24/97 : Pointer library added to the SWIG library. 4/19/97 : Added the %new directive. This is a "hint" that can be used to tell SWIG that a function is returning a new object. For example : %new Foo *create_foo(); This tells SWIG that create_foo() is creating a new object and returning a pointer to it. Many language modules may choose to ignore the hint, but when working with shadow classes, the %new is used to handle proper ownership of objects. %new can also be used with dynamically allocated strings. For example : %new char *create_string(); When used, all of the language modules will automatically cleanup the returned string--eliminating memory leaks. ** NEW FEATURE ** 4/19/97 : Added a new typemap "newfree". This is used in conjunction with the %new directive and can be used to change the method by which a new object returned by a function is deleted. 4/19/97 : The symbol "__cplusplus" is now defined in the SWIG interpreter when running with the -c++ option. 4/17/97 : Added support for static member functions when used inside the %addmethods directive. 4/15/97 : Added a special typemap symbol PREVIOUS that can be used to restore a previous typemap. For example : %typemap(tcl,in) int * = PREVIOUS; This is primarily used in library files. 4/13/97 : Added %pragma directive for Perl5 module. Two new pragmas are available : %pragma(perl5) code = "string" %pragma(perl5) include = "file.pl" Both insert code into the .pm file created by SWIG. This can be used to automatically customize the .pm file created by SWIG. 4/13/97 : Scanner modified to only recognize C++ keywords when the -c++ option has been specified. This provides support for C programs that make use of these keywords for identifiers. SWIG may need to be explicitly run with the -c++ option when compiling C++ code (this was allowed, but not recommended in previous versions). **POTENTIAL INCOMPATIBILITY** 4/11/97 : Fixed a rather nasty bug in the Perl5 module related to using variable linking with complex datatypes and pointers. On Unix, code would work (somehow), but would cause an access violation under Windows-NT. The fix should correct the problem, but there may still be a problem using global variables of complex datatypes in conjunction with shadow classes. Fortunately, this sort of thing seems to be relatively rare (considering that the bug has been around for more than a year - yikes!). 4/11/97 : Fixed bizarre constant evaluation bug in Perl5 code generation when running under Windows-NT. 4/8/97 : Bug when using default arguments and C++ references fixed. 4/8/97 : Fixed code generation bugs in Python and Perl5 modules related to using class renaming (applying the %name directive to a class definition) and shadow classes. 4/7/97 : Fixed minor bugs in swigptr.swg, tcl8ptr.swg, and perl5ptr.swg to prevent infinite loops when weird datatypes are passed. 3/29/97 : 'Makefile.win' added. This is used to build most of the examples in the Examples directory under Windows NT/95. 3/27/97 : Fixes to SWIG's error return codes. SWIG now returns non-zero exit codes for certain kinds of errors (which makes it more friendly to makefiles). An overhaul of the error handling is on the to-do list and will probably show up in a later release. 3/25/97 : Bug fix. "freearg" and "argout" typemaps have been fixed in the Perl5 module. In previous versions, function input parameters and function output parameters shared the same memory space--causing all sorts of nasty problems when trying to pass perl values by reference. SWIG now internally makes a "copy" (which is really just a pointer) of affected parameters and uses that. This is done transparently so there is no noticable impact on any SWIG generated modules. This change is probably only noticable to expert users. 3/25/97 : Added type-check to verbose and stat mode. SWIG will now generate a list of all datatypes that were used but undefined (useful for tracking down weird bugs). This is enabled with the -v option (which is now officially known as "overly verbose" mode) or the -stat option. 3/25/97 : Slight change to the parser to make include guards work correctly. For example : #ifndef INTERFACE_I #define INTERFACE_I %module foobar.i ... declarations ... #endif 3/24/97 : %checkout directive added. This allows an interface file to extract files from the SWIG library and place them in the current directory. This can be used to extract scripts and other helper code that might be associated with library files. For example : %checkout array.tcl Will look for a file "array.tcl" in the library and copy it to the current directory. If the file already exists in the directory, this directive does nothing (it will not overwrite an existing file). This only an experimental feature for now. 3/24/97 : SWIG will now look in the SWIG Library for a file if it can't find it in the current directory. As a result, it is easy to make modules from SWIG library files. For example, if you want to make a Python module from the SWIG timers library, just type this in any directory : swig -python timers.i You will get the files timers_wrap.c and timers_wrap.doc in the current directory that you can now compile. The file remains in the SWIG library (although you can check it out using the -co option). *** New Feature *** 3/24/97 : -co option added to SWIG to allow easy access to the SWIG library. When used, this instructs SWIG to check out a library file and place it in the current directory. For example : unix > swig -co array.i array.i checked out from the SWIG library unix > Once in your directory you can customize the file to suit your particular purposes. The checkout option makes it easy to grab library files without knowing anything about the SWIG installation, but it also makes it possible to start including scripts, C code, and other miscellaneous files in the library. For example, you could put a cool script in the library and check it out whenever you wanted to use it. *** New Feature *** 3/24/97 : #pragma export directives added to Tcl output for compiling shared libraries on the Mac. 3/24/97 : Minor changes to wish.i and tclsh.i library files to provide support for the Macintosh. 3/19/97 : SWIG's policy towards NULL pointers has been relaxed. The policy of requiring a special compiler directive -DALLOW_NULL to use NULL pointers is no longer supported. While this may seem "unsafe", it turns out that you can use a "check" typemap to achieve some safety. For example : %typemap(perl5,check) Node * { if (!$target) croak("NULL Pointers not allowed."); } This prevents any NULL value of a "Node *" pointer to be passed to a function. (I think this is much cleaner than the old -DALLOW_NULL hack anyways). 3/19/97 : Fixed pointer handling errors in Perl5 module. Modules no longer core dump when a Perl reference is inadvertently passed in as a C pointer. 3/18/97 : Added a "check" typemap. This can be used to check the validity of function input values. For example : %typemap(perl5,check) int posint { if ($target < 0) croak("Argument is not a positive integer"); } 3/18/97 : Added an $arg variable to Tcl typemaps. This makes it easier to return argument values by "reference". 3/18/97 : Fixed a code generation bug when using C++ references and the %addmethods directive. 3/18/97 : Fixed a few glitches in the typemap module with respect to chaining. For example : %typemap(tcl,in) int { $in // Inserts prexisting typemap printf("Received a %d\n", $target); } This has been allowed for quite some time, but didn't work if no existing typemap was defined. Now, it still doesn't work if no existing typemap is defined, but it issues a warning message. There is some support using default typemaps, but none of the language modules take advantage of it. This should be considered experimental at this time. Version 1.1b5 Patch 1 (March 16, 1997) ====================================== 3/16/97 : Fixed references bug with C++ code generation. 3/16/97 : Fixed initialization bug in the documentation system that was causing weird problems. 3/16/97 : Fixed fatal bug with -c option in the Python module. 3/13/97 : Fixed bug in the documentation system involving the %text directive and sorting. In the old system, %text entries would float to the top of a section because they were "nameless". Now they are attached to the previous declaration and will stay in the proper location relative to the previous entry. Version 1.1b5 (March 12, 1997) ============================== 3/11/97 : Fixed compilation problems introduced by Tcl/Tk 8.0a2. *** INCOMPATIBILITY *** SWIG no longer works with Tcl/Tk 8.0a1. 3/10/97 : Fixed bug with ignored arguments and C++ member functions in the Python module. 3/9/97 : Parsing bugs with nested class definitions and privately declared nested class definitions fixed. 3/9/97 : Fixed a few minor code generation bugs with C++ classes and constructors. In some cases, the resulting wrapper code would not compile properly. SWIG now attempts to use the default copy constructor instead. 3/8/97 : Added a -l option to SWIG that allows additional SWIG library files to be grabbed without having them specified in the interface file. This makes it easier to keep the interface file clean and move certain options into a Makefile. For example : swig -tcl example.i # Build a normal Tcl extension swig -tcl -lwish.i example.i # Build it as a wish extension # by including the 'wish.i' file. swig -python example.i # Build a dynamically loaded extension swig -python -lembed.i example.i # Build a static extension These kinds of options could previously be accomplished with conditional compilation such as : %module example ... #ifdef STATIC %include embed.i #endif 3/8/97 : Incorporated changes to Guile module to use the new gh interface in FSF Guile 1.0. The older gscm interface used in Cygnus Guile releases is no longer supported by SWIG. 3/8/97 : Cleaned up the Tcl Netscape plugin example. It should work with version 1.1 of the plugin now. 3/8/97 : Added better array support to the typemap module. The keyword ANY can now be used to match any array dimension. For example : %typemap(tcl,in) double [ANY] { ... get an array ... } This will match any single-dimensional double array. The array dimension is passed in the variables $dim0, $dim1, ... $dim9. For example : %typemap(tcl,in) double [ANY][ANY][ANY] { printf("Received a double[%d][%d][%d]\n",$dim0,$dim1,$dim2); } Any typemap involving a specific array dimension will override any specified with the ANY tag. Thus, a %typemap(tcl,in) double [5][4][ANY] {} would override a double [ANY][ANY][ANY]. However, overuse of the ANY tag in arrays of high-dimensions may not work as you expect due to the pattern matching rule used. For example, which of the following typemaps has precedence? %typemap(in) double [ANY][5] {} // Avoid this! %typemap(in) double [5][ANY] {} 3/7/97 : Fixed a number of bugs related to multi-dimensional array handling. Typedefs involving multi-dimensional arrays now works correctly. For example : typedef double MATRIX[4][4]; ... extern double foo(MATRIX a); Typecasting of pointers into multi-dimensional arrays is now implemented properly when making C/C++ function calls. 3/6/97 : Fixed potentially dangerous bug in the Tcl Object-oriented interface. Well, actually, didn't fix it but issued a Tcl error instead. The bug would manifest itself as follows: % set l [List] # Create an object ... % set m [List -this $l] # Make $m into an object assuming $l # contains a pointer. # Since $m == $l, $l gets destroyed # (since its the same command name) % $m insert Foo Segmentation fault # Note : the list no longer exists! Now, an error will be generated instead of redefining the command. As in : % set l [List] ... % set m [List -this $l] Object name already exists! Use catch{} to ignore the error. 3/3/97 : Better support for enums added. Datatypes of 'enum MyEnum' and typedefs such as 'typedef enum MyEnum Foo;' now work. 3/3/97 : Parser modified to ignore constructor initializers such as : class Foo : public Bar { int a,b; public: Foo(int i) : a(0), b(i), Bar(i,0) { }; }; 3/3/97 : Modified parser to ignore C++ exception specifications such as : int foo(double) throw(X,Y); 3/3/97 : Added %import directive. This works exactly like %extern except it tells the language module that the declarations are coming from a separate module. This is usually only needed when working with shadow classes. 3/2/97 : Changed pointer type-checker to be significantly more efficient when working with derived datatypes. This has been accomplished by storing type-mappings in sorted order, using binary search schemes, and caching recently used datatypes. For SWIG generated C++ modules that make a large number of C function calls with derived types, this could result in speedups of between 100 and 50000 percent. However, due to the required sorting operation, module loading time may increased slightly when there are lots of datatypes. 3/2/97 : Fixed some C++ compilation problems with Python embed.i library files. 2/27/97 : Slight change to C++ code generation to use copy constructors when returning complex data type by value. 2/26/97 : Fixed bug in Python module with -c option. 2/26/97 : Slight tweak of parser to allow trailing comma in enumerations such as enum Value (ALE, STOUT, LAGER, }; 2/25/97 : Fixed code generation bug in Tcl module when using the %name() directive on a classname. 2/25/97 : Finished code-size optimization of C++ code generation with inheritance of attributes. Inherited attributes now only generate one set of wrapper functions that are re-used in any derived classes. This could provide big code size improvements in some scripting language interfaces. 2/25/97 : Perl5 module modified to support both the Unix and Windows versions. The windows version has been tested with the Activeware port of Perl 5.003 running under Windows 95. The C source generated by SWIG should compile without modification under both versions of Perl, but is now even more hideous than before. 2/25/97 : Modified parser to allow scope resolution operation to appear in expressions and default arguments as in : void foo(int a = Bar::defvalue); 2/25/97 : Fixed bug when resolving symbols inside C++ classes. For example : class Foo { public: enum Value {ALE, STOUT, LAGER}; ... void defarg(Value v = STOUT); }; 2/24/97 : Fixed bug with member functions returning void *. 2/23/97 : Modified Python module to be better behaved under Windows - Module initialization function is now properly exported. It should not be necessary to explicitly export this function yourself. - Bizarre compilation problems when compiling the SWIG wrapper code as ANSI C under Visual C++ 4.x fixed. - Tested with both the stock Python-1.4 distribution and Pythonwin running under Win95. 2/19/97 : Fixed typedef handling bug in Perl5 shadow classes. 2/19/97 : Added exception support. To use it, do the following : %except(lang) { ... try part of the exception ... $function ... catch part of exception ... } $function is a SWIG variable that will be replaced by the actual C/C++ function call in a wrapper function. Thus, a real exception specification might look like this : %except(perl5) { try { $function } catch (char *& sz) { ... process an exception ... } catch(...) { croak("Unknown exception. Bailing out..."); } } 2/19/97 : Added support for managing generic code fragments (needed for exceptions). 2/19/97 : Fixed some really obscure typemap scoping bugs in the C++ handler. 2/18/97 : Cleaned up perlmain.i file by removing some problematic, but seemingly unnecessary declarations. 2/18/97 : Optimized handling of member functions under inheritance. SWIG can now use wrapper functions generated for a base class instead of regenerating wrappers for the same functions in a derived class. This could make a drastic reduction in wrapper code size for C++ applications with deep inheritance hierarchies and lots of functions. 2/18/97 : Additional methods specified with %addmethods can now be inherited along with normal C++ member functions. 2/18/97 : Minor internal fixes to make SWIG's string handling a little safer. 2/16/97 : Moved some code generation of Tcl shadow classes to library files. 2/16/97 : Fixed documentation error of '-configure' method in Tcl modules. 2/16/97 : Modified Perl5 module slightly to allow typemaps to use Perl references. 2/12/97 : Fixed argument checking bug that was introduced by default arguments (function calls with too many arguments would still be executed). Functions now must have the same number of arguments as C version (with possibility of default/optional arguments still supported). 2/12/97 : Fixed default argument bug in Perl5 module when generating wrapper functions involving default arguments of complex datatypes. 2/12/97 : Fixed typemap scoping problems. For example : %typemap(tcl,in) double { .. get a double .. } class Foo { public: double bar(double); } %typemap(tcl,in) double { .. new get double .. } Would apply the second typemap to all functions in Foo due to delayed generation of C++ wrapper code (clearly this is not the desired effect). Problem has been fixed by assigning unique numerical identifiers to every datatype in an interface file and recording the "range of effect" of each typemap. 2/11/97 : Added support for "ignore" and "default" typemaps. Only use if you absolutely know what you're doing. 2/9/97 : Added automatic creation of constructors and destructors for C structs and C++ classes that do not specify any sort of constructor or destructor. This feature can be enabled by running SWIG with the '-make_default' option or by inserting the following pragma into an interface file : %pragma make_default The following pragma disables automatic constructor generation %pragma no_default 2/9/97 : Added -make_default option for producing default constructors and destructors for classes without them. 2/9/97 : Changed the syntax of the SWIG %pragma directive to %pragma option=value or %pragma(lang) option=value. This change makes the syntax a little more consistent between general pragmas and language-specific pragmas. The old syntax still works, but will probably be phased out (a warning message is currently printed). 2/9/97 : Improved Tcl support of global variables that are of structures, classes, and unions. 2/9/97 : Fixed C++ compilation problem in Python 'embed.i' library file. 2/9/97 : Fixed missing return value in perlmain.i library file. 2/9/97 : Fixed Python shadow classes to return an AttributeError when undefined attributes are accessed (older versions returned a NameError). 2/9/97 : Fixed bug when %addmethods is used after a class definition whose last section is protected or private. 2/8/97 : Made slight changes in include file processing to support the Macintosh. 2/8/97 : Extended swigmain.cxx to provide a rudimentary Macintosh interface. It's a really bad interface, but works until something better is written. 1/29/97 : Fixed type-casting bug introduced by 1.1b4 when setting/getting the value of global variables involving complex data types. 1/29/97 : Removed erroneous white space before an #endif in the code generated by the Python module (was causing errors on DEC Alpha compilers). 1/26/97 : Fixed errors when using default/optional arguments in Python shadow shadow classes. 1/23/97 : Fixed bug with nested %extern declarations. 1/21/97 : Fixed problem with typedef involving const datatypes. 1/21/97 : Somewhat obscure, but serious bug with having multiple levels of typedefs fixed. For example : typedef char *String; typedef String Name; Version 1.1 Beta4 (January 16, 1997) ==================================== Note : SWIG 1.1b3 crashed and burned shortly after take off due to a few major run-time problems that surfaced after release. This release should fix most, if not all, of those problems. 1/16/97 : Fixed major memory management bug on Linux 1/14/97 : Fixed bug in functions returning constant C++ references. 1/14/97 : Modified C++ module to handle datatypes better. 1/14/97 : Modified parser to allow a *single* scope resolution operator in datatypes. Ie : Foo::bar. SWIG doesn't yet handle nested classes, so this should be sufficient for now. 1/14/97 : Modified parser to allow typedef inside a C++ class. 1/14/97 : Fixed some problems related to datatypes defined inside a C++ class. SWIG was not generating correct code, but a new scoping mechanism and method for handling datatypes inside a C++ class have been added. 1/14/97 : Changed enumerations to use the value name instead of any values that might have appeared in the interface file. This makes the code a little more friendly to C++ compilers. 1/14/97 : Removed typedef bug that made all enumerations equivalent to each other in the type checker (since it generated alot of unnecessary code). Version 1.1 Beta3 (January 9, 1997) =================================== Note : A *huge* number of changes related to ongoing modifications. 1. Support for C++ multiple inheritance added. 2. Typemaps added. 3. Some support for nested structure definitions added. 4. Default argument handling added. 5. -c option added for building bare wrapper code modules. 6. Rewrote Pointer type-checking to support multiple inheritance correctly. 7. Tcl 8.0 module added. 8. Perl4 and Guile modules resurrected from the dead (well, they at least work again). 9. New Object Oriented Tcl interface added. 10. Bug fixes to Perl5 shadow classes. 11. Cleaned up many of the internal modules of the parser. 12. Tons of examples and testing modules added. 13. Fixed bugs related to use of "const" return values. 14. Fixed bug with C++ member functions returning void *. 15. Changed SWIG configuration script. Version 1.1 Beta2 (December 3, 1996) ==================================== 1. Completely rewrote the SWIG documentation system. The changes involved are too numerous to mention. Basically, take everything you knew about the old system, throw them out, and read the file Doc/doc.ps. 2. Limited support for #if defined() added. 3. Type casts are now allowed in constant expressions. ie #define A (int) 3 4. Added support for typedef lists. For example : typedef struct { double x,y,z; } Vector, *VectorPtr; 5. New SWIG directives (related to documentation system) %style %localstyle %subsection %subsubsection 6. Reorganized the C++ handling and made it a little easier to work with internally. 7. Fixed problem with inheriting data members in Python shadow classes. 8. Fixed symbol table problems with shadow classes in both Python and Perl. 9. Fixed annoying segmentation fault bug in wrapper code generated for Perl5. 10. Fixed bug with %addmethods directive. Now it can be placed anywhere in a class. 11. More test cases added to the SWIG self-test. Documentation tests are now performed along with other things. 12. Reorganized the SWIG library a little bit and set it up to self-document itself using SWIG. 13. Lots and lots of minor bug fixes (mostly obscure, but bugs nonetheless). Version 1.1 Beta1 (October 30, 1996) ==================================== 1. Added new %extern directive for handling multiple files 2. Perl5 shadow classes added 3. Rewrote conditional compilation to work better 4. Added 'bool' datatype 5. %{,%} block is now optional. 6. Fixed some bugs in the Python shadow class module 7. Rewrote all of the SWIG tests to be more informative (and less scary). 8. Rewrote parameter list handling to be more memory efficient and flexible. 9. Changed parser to ignore 'static' declarations. 10. Initializers are now ignored. For example : struct FooBar a = {3,4,5}; 11. Somewhat better parsing of arrays (although it's usually just a better error message now). 12. Lot's of minor bug fixes. Version 1.0 Final (August 31, 1996) =================================== 1. Fixed minor bug in C++ module 2. Fixed minor bug in pointer type-checker when using -DALLOW_NULL. 3. Fixed configure script to work with Python 1.4beta3 4. Changed configure script to allow compilation without yacc or bison. Version 1.0 Final (August 28, 1996) =================================== 1. Changed parser to support more C/C++ datatypes (well, more variants). Types like "unsigned", "short int", "long int", etc... now work. 2. "unions" added to parser. 3. Use of "typedef" as in : typedef struct { double x,y,z; } Vector; Now works correctly. The name of the typedef is used as the structure name. 4. Conditional compilation with #ifdef, #else, #endif, etc... added. 5. New %disabledoc, %enabledoc directives allow documentation to selectively be disabled for certain parts of a wrapper file. 6. New Python module supports better variable linking, constants, and shadow classes. 7. Perl5 module improved with better compatibility with XS and xsubpp. SWIG pointers and now created so that they are compatible with xsubpp pointers. 8. Support for [incr Tcl] namespaces added to Tcl module. 9. %pragma directive added. 10. %addmethods directive added. 11. %native directive added to allow pre-existing wrapper functions to be used. 12. Wrote configure script for SWIG installation. 13. Function pointers now allowed with typedef statements. 14. %typedef modified to insert a corresponding C typedef into the output file. 15. Fixed some problems related to C++ references. 16. New String and WrapperFunction classes add to make generating wrapper code easier. 17. Fixed command line option processing to eliminate core dumps and to allow help messages. 18. Lot's of minor bug fixes to almost all code modules Version 1.0 Beta 3 (Patch 1) July 17, 1996 ========================================== 1.0 Final is not quite ready yet, but this release fixes a number of immediate problems : 1. Compiler errors when using -strict 1 type checking have been fixed. 2. Pointer type checker now recognizes pointers of the form _0_Type correctly. 3. A few minor fixes were made in the Makefile Version 1.0 Beta 3 (June 14, 1996) ================================== There are lots of changes in this release : 1. SWIG is now invoked using the "swig" command instead of "wrap". Hey, swig sounds cooler. 2. The SWIG_LIB environment variable can be set to change the location where SWIG looks for library files. 3. C++ support has been added. You should use the -c++ option to enable it. 4. The %init directive has been replaced by the %module directive. %module constructs a valid name for the initialization function for whatever target language you're using (actually this makes SWIG files a little cleaner). The old %init directive still works. 5. The syntax of the %name directive has been changed. Use of the old one should generate a warning message, but may still work. 6. To support Tcl/Tk on non-unix platforms, SWIG imports a file called swigtcl.cfg from the $(SWIG_LIB)/tcl directory. I don't have access to an NT machine, but this file is supposedly allows SWIG to produce wrapper code that compiles on both UNIX and non UNIX machines. If this doesn't work, you'll have to edit the file swigtcl.cfg. Please let me know if this doesn't work so I can update the file as necessary. 7. The SWIG run-time typechecker has been improved. You can also now redefine how it works by supplying a file called "swigptr.cfg" in the same directory as your SWIG interface files. By default, SWIG reads this file from $(SWIG_LIB)/config. 8. The documentation system has been changed to support the following : - Documentation order is printed in interface file order by default. This can be overridden by putting an %alpha directive in the beginning of the interface file. - You can supply additional documentation text using %text %{ put your text here %} - A few minor bugs were fixed. 9. A few improvements have been made to the handling of command line options (but it's still not finished). 10. Lots of minor bug fixes in most of the language modules have been made. 11. Filenames have been changed to 8.3 for compatibility with a SWIG port to non-unix platforms (work in progress). 12. C++ file suffix is now .cxx (for same reason). 13. The documentation has been upgraded significantly and is now around 100 pages. I added new examples and a section on C++. The documentation now includes a Table of Contents. 14. The SWIG Examples directory is still woefully sparse, but is getting better. Special notice about C++ ------------------------ This is the first version of SWIG to support C++ parsing. Currently the C++ is far from complete, but seems to work for simple cases. No work has been done to add special C++ processing to any of the target languages. See the user manual for details about how C++ is handled. If you find problems with the C++ implementation, please let me know. Expect major improvements in this area. Note : I have only successfully used SWIG and C++ with Tcl and Python. Notice about Version 1.0Final ----------------------------- Version 1.0B3 is the last Beta release before version 1.0 Final is released. I have frozen the list of features supported in version 1.0 and will only fix bugs as they show up. Work on SWIG version 2.0 is already in progress, but is going to result in rather significant changes to SWIG's internal structure (hopefully for the better). No anticipated date for version 2.0 is set, but if you've got an idea, let me know. Version 1.0 Beta 2 (April 26, 1996) =================================== This release is identical to Beta1 except a few minor bugs are fixed and the SWIG library has been updated to work with Tcl 7.5/Tk 4.1. A tcl7.5 examples directory is now included. - Fixed a bug in the Makefile that didn't install the libraries correctly. - SWIG Library files are now updated to work with Tcl 7.5 and Tk 4.1. - Minor bug fixes in other modules. Version 1.0 Beta 1 (April 10, 1996). ===================================== This is the first "semi-official" release of SWIG. It has a number of substantial improvements over the Alpha release. These notes are in no particular order--hope I remembered everything.... 1. Tcl/Tk SWIG is known to work with Tcl7.3, Tk3.6 and later versions. I've also tested SWIG with expect-5.19. Normally SWIG expects to use the header files "tcl.h" and "tk.h". Newer versions of Tcl/Tk use version numbers. You can specify these in SWIG as follows : % wrap -htcl tcl7.4.h -htk tk4.0.h example.i Of course, I prefer to simply set up symbolic links between "tcl.h" and the most recent stable version on the machine. 2. Perl4 This implementation has been based on Perl-4.035. SWIG's interface to Perl4 is based on the documentation provided in the "Programming Perl" book by Larry Wall, and files located in the "usub" directory of the Perl4 distribution. In order to compile with Perl4, you'll need to link with the uperl.o file found in the Perl4 source directory. You may want to move this file to a more convenient location. 3. Perl5 This is a somewhat experimental implementation, but is alot less buggy than the alpha release. SWIG operates independently of the XS language and xsubpp supplied with Perl5. Currently SWIG produces the necessary C code and .pm file needed to dynamically load a module into Perl5. To support Perl5's notion of modules and packages (as with xsubpp), you can use the following command line options : % wrap -perl5 -module MyModule -package MyPackage example.i Note : In order for dynamic loading to be effective, you need to be careful about naming. For a module named "MyModule", you'll need to create a shared object file called "MyModule.so" using something like % ld -shared my_obj.o -o MyModule.so The use of the %init directive must match the module name since Perl5 calls a function "boot_ModuleName" in order to initialize things. See the Examples directory for some examples of how to get things to work. 4. Python1.3 This is the first release supporting Python. The Python port is experimental and may be rewritten. Variable linkage is done through functions which is sort of a kludge. I also think it would be nice to import SWIG pointers into Python as a new object (instead of strings). Of course, this needs a little more work. 5. Guile3 If you really want to live on the edge, pick up a copy of Guile-iii and play around with this. This is highly experimental---especially since I'm not sure what the official state of Guile is these days. This implementation may change at any time should I suddenly figure out better ways to do things. 6. Extending SWIG SWIG is written in C++ although I tend to think of the code as mostly being ANSI C with a little inheritance thrown in. Each target language is implemented as a C++ class that can be plugged into the system. If you want to add your own modifications, see Appendix C of the user manual. Then take a look at the "user" directory which contains some code for building your own extenions. 7. The SWIG library The SWIG library is still incomplete. Some of the files mentioned in the user manual are unavailable. These files will be made available when they are ready. Subscribe to the SWIG mailing list for announcements and updates. 8. SWIG Documentation I have sometimes experienced problems viewing the SWIG documentation in some postscript viewers. However, the documentation seems to print normally. I'm working on making much of the documentation online, but this takes time. Version 0.1 Alpha (February 9, 1996) ==================================== 1. Run-time type-checking of SWIG pointers. Pointers are now represented as strings with both numeric and encoded type information. This makes it a little harder to shoot yourself in the foot (and it eliminates some segmentation faults and other oddities). 2. Python 1.3 now supported. 3. #define and enum can be used to install constants. 4. Completely rewrote the %include directive and made it alot more powerful. 5. Restructured the SWIG library to make it work better. 6. Various bug fixes to Tcl, Perl4, Perl5, and Guile implementations. 7. Better implementation of %typedef directive. 8. Made some changes to SWIG's class structure to make it easier to expand. SWIG is now built into a library file that you can use to make your own extenions. 9. Made extensive changes to the documentation. 10. Minor changes to the SWIG parser to make it use less memory. Also took out some extraneous rules that were undocumented and didn't work in the first place. 11. The SWIG library files "tclsh", "wish", "expect", etc... in the first release have been restructured and renamed to "tclsh.i", "wish.i", and so on.