Merge branch 'master' into gsoc2009-matevz

parser.y still to be fixed up

Conflicts:
	Doc/Devel/engineering.html
	Examples/Makefile.in
	Lib/allegrocl/allegrocl.swg
	Lib/csharp/csharp.swg
	Lib/csharp/enums.swg
	Lib/csharp/enumsimple.swg
	Lib/csharp/enumtypesafe.swg
	Lib/java/java.swg
	Lib/python/pydocs.swg
	Lib/r/rtype.swg
	Source/Include/swigwarn.h
	Source/Modules/octave.cxx
	Source/Modules/python.cxx
	Source/Modules/ruby.cxx
	Source/Swig/scanner.c
	Source/Swig/stype.c
	Source/Swig/swig.h
	configure.ac
This commit is contained in:
William S Fulton 2013-01-28 07:01:37 +00:00
commit e805d5f925
1074 changed files with 54339 additions and 20134 deletions

View file

@ -72,7 +72,7 @@ typedef TYPE NAME;
%}
typedef struct NAME {
typedef struct {
} NAME;
%extend NAME {

View file

@ -55,20 +55,20 @@ typedef struct {
return %new_instance(TYPE);
}
~NAME() {
if (self) %delete(self);
if ($self) %delete($self);
}
}
%extend NAME {
void assign(TYPE value) {
*self = value;
*$self = value;
}
TYPE value() {
return *self;
return *$self;
}
TYPE * cast() {
return self;
return $self;
}
static NAME * frompointer(TYPE *t) {
return (NAME *) t;
@ -113,24 +113,24 @@ typedef struct {
return %new_copy(value, TYPE);
}
static void delete_##NAME(TYPE *self) {
if (self) %delete(self);
static void delete_##NAME(TYPE *obj) {
if (obj) %delete(obj);
}
static void NAME ##_assign(TYPE *self, TYPE value) {
*self = value;
static void NAME ##_assign(TYPE *obj, TYPE value) {
*obj = value;
}
static TYPE NAME ##_value(TYPE *self) {
return *self;
static TYPE NAME ##_value(TYPE *obj) {
return *obj;
}
%}
TYPE *new_##NAME();
TYPE *copy_##NAME(TYPE value);
void delete_##NAME(TYPE *self);
void NAME##_assign(TYPE *self, TYPE value);
TYPE NAME##_value(TYPE *self);
void delete_##NAME(TYPE *obj);
void NAME##_assign(TYPE *obj, TYPE value);
TYPE NAME##_value(TYPE *obj);
%enddef

View file

@ -149,6 +149,10 @@
#endif
%}
%fragment("<stddef.h>", "header") %{
#include <stddef.h>
%}
/* -----------------------------------------------------------------------------
* special macros for fragments
* ----------------------------------------------------------------------------- */

View file

@ -22,8 +22,8 @@
which can always be redefined in the swig target language if needed.
The fragments for the following types, however, need to be defined
in the target language always:
The fragments for the following types, however, always need to be
defined in the target language:
long
unsigned long
@ -40,7 +40,7 @@
%typemaps_primitive(CheckCode, Type)
which generate the typemaps for a primitive type with a given
which generates the typemaps for a primitive type with a given
checkcode. It is assumed that the primitive type is 'normalized' and
the corresponding SWIG_AsVal(Type) and SWIG_From(Type) methods are
provided via fragments.

View file

@ -66,14 +66,14 @@
/* directorout */
%define %ptr_directorout_typemap(asptr_meth,frag,Type...)
%typemap(directorargout,noblock=1,fragment=frag) Type *DIRECTOROUT ($*ltype temp) {
%typemap(directorargout,noblock=1,fragment=frag) Type *DIRECTOROUT ($*ltype temp, int swig_ores) {
Type *swig_optr = 0;
int swig_ores = $input ? asptr_meth($input, &swig_optr) : 0;
swig_ores = $result ? asptr_meth($result, &swig_optr) : 0;
if (!SWIG_IsOK(swig_ores) || !swig_optr) {
%dirout_fail((swig_optr ? swig_ores : SWIG_TypeError),"$type");
}
temp = *swig_optr;
$result = &temp;
$1 = &temp;
if (SWIG_IsNewObj(swig_ores)) %delete(swig_optr);
}

View file

@ -1,5 +1,4 @@
%include <typemaps/exception.swg>
%include <std/std_except.i>
/*
Mark all of std exception classes as "exception classes" via
@ -34,63 +33,4 @@ namespace std {
%std_exception_map(underflow_error, SWIG_OverflowError);
}
#if defined(SWIG_STD_EXCEPTIONS_AS_CLASSES)
namespace std {
struct exception
{
virtual ~exception() throw();
virtual const char* what() const throw();
};
struct bad_exception : exception
{
};
struct logic_error : exception
{
logic_error(const string& msg);
};
struct domain_error : logic_error
{
domain_error(const string& msg);
};
struct invalid_argument : logic_error
{
invalid_argument(const string& msg);
};
struct length_error : logic_error
{
length_error(const string& msg);
};
struct out_of_range : logic_error
{
out_of_range(const string& msg);
};
struct runtime_error : exception
{
runtime_error(const string& msg);
};
struct range_error : runtime_error
{
range_error(const string& msg);
};
struct overflow_error : runtime_error
{
overflow_error(const string& msg);
};
struct underflow_error : runtime_error
{
underflow_error(const string& msg);
};
}
#endif
%include <std/std_except.i>

View file

@ -40,11 +40,7 @@ SWIG_AsPtr_dec(String)(SWIG_Object obj, String **val)
SWIGINTERNINLINE SWIG_Object
SWIG_From_dec(String)(const String& s)
{
if (s.size()) {
return SWIG_FromCharPtrAndSize(s.data(), s.size());
} else {
return SWIG_FromCharPtrAndSize(s.c_str(), 0);
}
return SWIG_FromCharPtrAndSize(s.data(), s.size());
}
}
%enddef

View file

@ -24,7 +24,9 @@
SWIG_CharPtrLen,
SWIG_AsCharPtr,
SWIG_FromCharPtr,
SWIG_AsCharArray)
SWIG_AsCharArray,
SWIG_NewCopyCharArray,
SWIG_DeleteCharArray)
/* in */
@ -38,7 +40,7 @@
$1 = %reinterpret_cast(buf, $1_ltype);
}
%typemap(freearg,noblock=1,match="in") Char *, const Char * {
if (alloc$argnum == SWIG_NEWOBJ) %delete_array(buf$argnum);
if (alloc$argnum == SWIG_NEWOBJ) SWIG_DeleteCharArray(buf$argnum);
}
%typemap(in,noblock=1,fragment=#SWIG_AsCharPtr) Char const*& (int res, Char *buf = 0, int alloc = 0) {
@ -49,7 +51,7 @@
$1 = &buf;
}
%typemap(freearg, noblock=1,match="in") Char const*& {
if (alloc$argnum == SWIG_NEWOBJ) %delete_array(buf$argnum);
if (alloc$argnum == SWIG_NEWOBJ) SWIG_DeleteCharArray(buf$argnum);
}
/* out */
@ -64,7 +66,7 @@
}
%typemap(newfree,noblock=1) Char * {
%delete_array($1);
SWIG_DeleteCharArray($1);
}
/* varin */
@ -75,11 +77,11 @@
if (!SWIG_IsOK(res)) {
%variable_fail(res,"$type","$name");
}
if ($1) %delete_array($1);
if ($1) SWIG_DeleteCharArray($1);
if (alloc == SWIG_NEWOBJ) {
$1 = cptr;
} else {
$1 = csize ? ($1_type)%new_copy_array(cptr, csize, Char) : 0;
$1 = csize ? ($1_type)SWIG_NewCopyCharArray(cptr, csize, Char) : 0;
}
}
@ -92,7 +94,7 @@
if (alloc == SWIG_NEWOBJ) {
$1 = cptr;
} else {
$1 = csize ? ($1_type)%new_copy_array(cptr, csize, Char) : 0;
$1 = csize ? ($1_type)SWIG_NewCopyCharArray(cptr, csize, Char) : 0;
}
}
@ -105,10 +107,10 @@
/* memberin */
%typemap(memberin,noblock=1) Char * {
if ($1) %delete_array($1);
if ($1) SWIG_DeleteCharArray($1);
if ($input) {
size_t size = SWIG_CharPtrLen(%reinterpret_cast($input, const Char *)) + 1;
$1 = ($1_type)%new_copy_array(%reinterpret_cast($input, const Char *), size, Char);
$1 = ($1_type)SWIG_NewCopyCharArray(%reinterpret_cast($input, const Char *), size, Char);
} else {
$1 = 0;
}
@ -117,7 +119,7 @@
%typemap(memberin,noblock=1,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG) const Char * {
if ($input) {
size_t size = SWIG_CharPtrLen(%reinterpret_cast(%reinterpret_cast($input, const Char *), const Char *)) + 1;
$1 = ($1_type)%new_copy_array($input, size, Char);
$1 = ($1_type)SWIG_NewCopyCharArray($input, size, Char);
} else {
$1 = 0;
}
@ -126,10 +128,10 @@
/* globalin */
%typemap(globalin,noblock=1) Char * {
if ($1) %delete_array($1);
if ($1) SWIG_DeleteCharArray($1);
if ($input) {
size_t size = SWIG_CharPtrLen(%reinterpret_cast(%reinterpret_cast($input, const Char *), const Char *)) + 1;
$1 = ($1_type)%new_copy_array($input, size, Char);
$1 = ($1_type)SWIG_NewCopyCharArray($input, size, Char);
} else {
$1 = 0;
}
@ -138,7 +140,7 @@
%typemap(globalin,noblock=1,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG) const Char * {
if ($input) {
size_t size = SWIG_CharPtrLen($input) + 1;
$1 = ($1_type)%new_copy_array($input, size, Char);
$1 = ($1_type)SWIG_NewCopyCharArray($input, size, Char);
} else {
$1 = 0;
}
@ -159,7 +161,7 @@
%typemap(directorin,noblock=1,fragment=#SWIG_FromCharPtr)
Char *, Char const*, Char *const, Char const *const,
Char const *&, Char *const &, Char const *const & {
$input = SWIG_FromCharPtr((const Char *)$1_name);
$input = SWIG_FromCharPtr((const Char *)$1);
}
@ -206,7 +208,7 @@
/* typecheck */
%typemap(typecheck,noblock=1,precedence=StringCode,
fragment=#SWIG_AsCharPtr) Char *, Char const*& {
fragment=#SWIG_AsCharPtr) Char *, const Char *, Char const*& {
int res = SWIG_AsCharPtr($input, 0, 0);
$1 = SWIG_CheckState(res);
}
@ -326,9 +328,9 @@
{
size_t size = $1_dim0;
%#ifndef SWIG_PRESERVE_CARRAY_SIZE
while (size && ($1_name[size - 1] == '\0')) --size;
while (size && ($1[size - 1] == '\0')) --size;
%#endif
$input = SWIG_FromCharPtrAndSize($1_name, size);
$input = SWIG_FromCharPtrAndSize($1, size);
}
/* directorout */
@ -351,7 +353,7 @@
%typemap(typecheck,noblock=1,precedence=StringCode,
fragment=#SWIG_AsCharArray)
Char [ANY], const Char[ANY] {
int res = SWIG_AsCharArray($input, (Char *)0, 0);
int res = SWIG_AsCharArray($input, (Char *)0, $1_dim0);
$1 = SWIG_CheckState(res);
}
@ -389,7 +391,7 @@
%typemap(directorin,noblock=1,fragment=#SWIG_FromCharPtrAndSize)
Char FIXSIZE[ANY], const Char FIXSIZE[ANY]
{
$input = SWIG_FromCharPtrAndSize($1_name, $1_dim0);
$input = SWIG_FromCharPtrAndSize($1, $1_dim0);
}
#endif /* SWIG_DIRECTOR_TYPEMAPS */
@ -416,7 +418,7 @@
$2 = %numeric_cast(size - 1, $2_ltype);
}
%typemap(freearg,noblock=1,match="in") (Char *STRING, size_t LENGTH) {
if (alloc$argnum == SWIG_NEWOBJ) %delete_array(buf$argnum);
if (alloc$argnum == SWIG_NEWOBJ) SWIG_DeleteCharArray(buf$argnum);
}
/* old 'int' form */
%typemap(in) (Char *STRING, int LENGTH) = (Char *STRING, size_t LENGTH);
@ -436,7 +438,7 @@
$2 = %numeric_cast(size, $2_ltype);
}
%typemap(freearg,noblock=1,match="in") (Char *STRING, size_t SIZE) {
if (alloc$argnum == SWIG_NEWOBJ) %delete_array(buf$argnum);
if (alloc$argnum == SWIG_NEWOBJ) SWIG_DeleteCharArray(buf$argnum);
}
/* old 'int' form */
%typemap(in) (Char *STRING, int SIZE) = (Char *STRING, size_t SIZE);
@ -448,7 +450,7 @@
/* Here len doesn't include the '0' terminator */
%typemap(in,noblock=1,fragment=#SWIG_AsCharPtrAndSize)
(size_t LENGTH, Char *STRING) (int res, Char *buf = 0, size_t size = 0, int alloc = 0),
(size_t LENGHT, const Char *STRING) (int res, Char *buf = 0, size_t size = 0, int alloc = 0)
(size_t LENGTH, const Char *STRING) (int res, Char *buf = 0, size_t size = 0, int alloc = 0)
{
res = SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc);
if (!SWIG_IsOK(res)) {
@ -458,7 +460,7 @@
$1 = %numeric_cast(size - 1, $1_ltype) ;
}
%typemap(freearg, noblock=1, match="in") (size_t LENGTH, Char *STRING) {
if (alloc$argnum == SWIG_NEWOBJ) %delete_array(buf$argnum);
if (alloc$argnum == SWIG_NEWOBJ) SWIG_DeleteCharArray(buf$argnum);
}
/* old 'int' form */
%typemap(in) (int LENGTH, Char *STRING) = (size_t LENGTH, Char *STRING);
@ -477,7 +479,7 @@
$1 = %numeric_cast(size, $1_ltype) ;
}
%typemap(freearg, noblock=1, match="in") (size_t SIZE, Char *STRING) {
if (alloc$argnum == SWIG_NEWOBJ) %delete_array(buf$argnum);
if (alloc$argnum == SWIG_NEWOBJ) SWIG_DeleteCharArray(buf$argnum);
}
/* old 'int' form */
%typemap(in) (int SIZE, Char *STRING) = (size_t SIZE, Char *STRING);
@ -492,11 +494,13 @@
* ------------------------------------------------------------ */
%define %typemaps_string(StringCode, CharCode,
%define %_typemap2_string(StringCode, CharCode,
Char, CharName,
SWIG_AsCharPtrAndSize,
SWIG_FromCharPtrAndSize,
SWIG_CharPtrLen,
SWIG_NewCopyCharArray,
SWIG_DeleteCharArray,
FragLimits, CHAR_MIN, CHAR_MAX)
%fragment("SWIG_From"#CharName"Ptr","header",fragment=#SWIG_FromCharPtrAndSize) {
@ -533,12 +537,12 @@ SWIG_As##CharName##Array(SWIG_Object obj, Char *val, size_t size)
if (csize < size) memset(val + csize, 0, (size - csize)*sizeof(Char));
}
if (alloc == SWIG_NEWOBJ) {
%delete_array(cptr);
SWIG_DeleteCharArray(cptr);
res = SWIG_DelNewMask(res);
}
return res;
}
if (alloc == SWIG_NEWOBJ) %delete_array(cptr);
if (alloc == SWIG_NEWOBJ) SWIG_DeleteCharArray(cptr);
}
return SWIG_TypeError;
}
@ -577,8 +581,6 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val)
}
}
%typemaps_asvalfromn(CharCode, Char);
%_typemap_string(StringCode,
Char,
SWIG_AsCharPtrAndSize,
@ -586,6 +588,51 @@ SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val)
SWIG_CharPtrLen,
SWIG_As##CharName##Ptr,
SWIG_From##CharName##Ptr,
SWIG_As##CharName##Array)
SWIG_As##CharName##Array,
SWIG_NewCopyCharArray,
SWIG_DeleteCharArray)
%enddef
/* ------------------------------------------------------------
* String typemaps and fragments, with default allocators
* ------------------------------------------------------------ */
%define %typemaps_string(StringCode, CharCode,
Char, CharName,
SWIG_AsCharPtrAndSize,
SWIG_FromCharPtrAndSize,
SWIG_CharPtrLen,
FragLimits, CHAR_MIN, CHAR_MAX)
%_typemap2_string(StringCode, CharCode,
Char, CharName,
SWIG_AsCharPtrAndSize,
SWIG_FromCharPtrAndSize,
SWIG_CharPtrLen,
%new_copy_array,
%delete_array,
FragLimits, CHAR_MIN, CHAR_MAX)
%enddef
/* ------------------------------------------------------------
* String typemaps and fragments, with custom allocators
* ------------------------------------------------------------ */
%define %typemaps_string_alloc(StringCode, CharCode,
Char, CharName,
SWIG_AsCharPtrAndSize,
SWIG_FromCharPtrAndSize,
SWIG_CharPtrLen,
SWIG_NewCopyCharArray,
SWIG_DeleteCharArray,
FragLimits, CHAR_MIN, CHAR_MAX)
%_typemap2_string(StringCode, CharCode,
Char, CharName,
SWIG_AsCharPtrAndSize,
SWIG_FromCharPtrAndSize,
SWIG_CharPtrLen,
SWIG_NewCopyCharArray,
SWIG_DeleteCharArray,
FragLimits, CHAR_MIN, CHAR_MAX)
%enddef

View file

@ -30,7 +30,7 @@
#if defined(SWIG_DIRECTOR_TYPEMAPS)
%typemap(directorin) SWIG_Object "$input = $1_name";
%typemap(directorin) SWIG_Object "$input = $1;";
%typemap(directorout) SWIG_Object "$result = $input;";
#endif /* SWIG_DIRECTOR_TYPEMAPS */

View file

@ -352,7 +352,7 @@
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE *const& {
void *vptr = 0;
int res = SWIG_ConvertPtr($input, &vptr, $descriptor, 0);
int res = SWIG_ConvertPtr($input, &vptr, $*descriptor, 0);
$1 = SWIG_CheckState(res);
}
@ -411,15 +411,15 @@
/* directorin */
%typemap(directorin,noblock=1) SWIGTYPE *, SWIGTYPE *const& {
$input = SWIG_NewPointerObj(%as_voidptr($1_name), $descriptor, %newpointer_flags);
$input = SWIG_NewPointerObj(%as_voidptr($1), $descriptor, %newpointer_flags);
}
%typemap(directorin,noblock=1) SWIGTYPE {
$input = SWIG_NewPointerObj(%as_voidptr(&$1_name), $&descriptor, %newpointer_flags);
$input = SWIG_NewPointerObj(%as_voidptr(&$1), $&descriptor, %newpointer_flags);
}
%typemap(directorin,noblock=1) SWIGTYPE & {
$input = SWIG_NewPointerObj(%as_voidptr(&$1_name), $descriptor, %newpointer_flags);
$input = SWIG_NewPointerObj(%as_voidptr(&$1), $descriptor, %newpointer_flags);
}
%typemap(directorin,noblock=1) SWIGTYPE && {
@ -571,7 +571,7 @@
/* directorin */
%typemap(directorin,noblock=1) SWIGTYPE (CLASS::*) {
$input = SWIG_NewMemberObj(%as_voidptr(&$1_name), sizeof($type), $descriptor);
$input = SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($type), $descriptor);
}
/* directorout */
@ -631,7 +631,7 @@
/* directorin */
%typemap(directorin,noblock=1) SWIGTYPE ((*)(ANY)) {
$input = SWIG_NewFunctionPtrObj((void*)($1_name), $descriptor);
$input = SWIG_NewFunctionPtrObj((void*)($1), $descriptor);
}
/* directorout */
@ -650,11 +650,6 @@
* --- Special typemaps ---
* ------------------------------------------------------------ */
/* VARARGS_SENTINEL typemap. Used by the %varargs directive. */
%typemap(in,numinputs=0) SWIGTYPE *VARARGS_SENTINEL, SWIGTYPE VARARGS_SENTINEL "";
/* DISOWN typemap */
%typemap(in, noblock=1) SWIGTYPE *DISOWN (int res = 0) {

View file

@ -97,23 +97,22 @@
%define %value_directorin_typemap(from_meth,frag,Type...)
%typemap(directorin,noblock=1,fragment=frag) Type *DIRECTORIN {
$input = from_meth(%static_cast(*$1_name,Type));
$input = from_meth(%static_cast(*$1,Type));
}
%typemap(directorin,noblock=1,fragment=frag) Type, const Type& {
$input = from_meth(%static_cast($1_name,Type));
$input = from_meth(%static_cast($1,Type));
}
%enddef
/* directorout */
%define %value_directorout_typemap(asval_meth,frag,Type...)
%typemap(directorargout,noblock=1,fragment=frag) Type *DIRECTOROUT {
Type swig_val;
int swig_res = asval_meth($input, &swig_val);
%typemap(directorargout,noblock=1,fragment=frag) Type *DIRECTOROUT(Type swig_val, int swig_res) {
swig_res = asval_meth($result, &swig_val);
if (!SWIG_IsOK(swig_res)) {
%dirout_fail(swig_res, "$type");
}
*$result = %static_cast(swig_val, $type);
*$1 = swig_val;
}
%typemap(directorout,noblock=1,fragment=frag) Type {
Type swig_val;

View file

@ -56,7 +56,7 @@
%typemap(directorin,noblock=1) void *, void const*, void *const, void const *const,
void const *&, void *const &, void const *const & {
$input = SWIG_NewPointerObj(%as_voidptr($1_name), $descriptor, %newpointer_flags);
$input = SWIG_NewPointerObj(%as_voidptr($1), $descriptor, %newpointer_flags);
}
/* directorout */