Add newmemory parameter for SWIG_TypeCast

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10240 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2008-02-10 00:35:11 +00:00
commit a91e4906b5
12 changed files with 51 additions and 13 deletions

View file

@ -275,7 +275,9 @@ SWIG_Chicken_ConvertPtr(C_word s, void **result, swig_type_info *type, int flags
if (type) {
cast = SWIG_TypeCheckStruct(from, type);
if (cast) {
*result = SWIG_TypeCast(cast, (void *) C_block_item(s, 0));
int newmemory = 0;
*result = SWIG_TypeCast(cast, (void *) C_block_item(s, 0), &newmemory);
assert(!newmemory); /* newmemory handling not yet implemented */
} else {
return 1;
}

View file

@ -12,6 +12,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#ifdef __cplusplus
extern "C" {
@ -161,7 +162,9 @@ SWIG_Guile_ConvertPtr(swig_module_info *module, SCM s, void **result,
if (type) {
cast = SWIG_TypeCheckStruct(from, type);
if (cast) {
*result = SWIG_TypeCast(cast, (void *) SCM_CDR(s));
int newmemory = 0;
*result = SWIG_TypeCast(cast, (void *) SCM_CDR(s), &newmemory);
assert(!newmemory); /* newmemory handling not yet implemented */
return SWIG_OK;
} else {
return SWIG_ERROR;

View file

@ -9,6 +9,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#ifdef __cplusplus
extern "C" {
@ -163,7 +164,9 @@ SWIG_Guile_ConvertPtr(SCM s, void **result, swig_type_info *type, int flags)
if (type) {
cast = SWIG_TypeCheckStruct(from, type);
if (cast) {
*result = SWIG_TypeCast(cast, (void *) SCM_CELL_WORD_1(smob));
int newmemory = 0;
*result = SWIG_TypeCast(cast, (void *) SCM_CELL_WORD_1(smob), &newmemory);
assert(!newmemory); /* newmemory handling not yet implemented */
return SWIG_OK;
} else {
return SWIG_ERROR;

View file

@ -608,7 +608,9 @@ SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State* L,int index,void** ptr,swig_type
cast=SWIG_TypeCheckStruct(usr->type,type); /* performs normal type checking */
if (cast)
{
*ptr=SWIG_TypeCast(cast,usr->ptr);
int newmemory = 0;
*ptr=SWIG_TypeCast(cast,usr->ptr,&newmemory);
assert(!newmemory); /* newmemory handling not yet implemented */
return SWIG_OK; /* ok */
}
}

View file

@ -10,6 +10,7 @@
#include <stdlib.h>
#include <limits.h>
#include <escheme.h>
#include <assert.h>
#ifdef __cplusplus
extern "C" {
@ -167,7 +168,9 @@ SWIG_MzScheme_ConvertPtr(Scheme_Object *s, void **result, swig_type_info *type,
if (type) {
cast = SWIG_TypeCheckStruct(proxy->type, type);
if (cast) {
*result = SWIG_TypeCast(cast, proxy->object);
int newmemory = 0;
*result = SWIG_TypeCast(cast, proxy->object, &newmemory);
assert(!newmemory); /* newmemory handling not yet implemented */
return 0;
} else {
return 1;

View file

@ -65,7 +65,9 @@ extern "C" {
tc ? tc->str : "<none>" );
#endif
if( tc ) {
*ptr = SWIG_TypeCast( tc, source );
int newmemory = 0;
*ptr = SWIG_TypeCast(tc, source, &newmemory);
assert(!newmemory); /* newmemory handling not yet implemented */
return 0;
} else
return -1;

View file

@ -265,7 +265,11 @@ SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *
if (!tc) {
return SWIG_ERROR;
}
*ptr = SWIG_TypeCast(tc,voidptr);
{
int newmemory = 0;
*ptr = SWIG_TypeCast(tc,voidptr,&newmemory);
assert(!newmemory); /* newmemory handling not yet implemented */
}
} else {
*ptr = voidptr;
}

View file

@ -122,6 +122,7 @@ SWIG_ZTS_SetPointerZval(zval *z, void *ptr, swig_type_info *type, int newobject
static void *
SWIG_ZTS_ConvertResourceData(void * p, const char *type_name, swig_type_info *ty TSRMLS_DC) {
swig_cast_info *tc;
void *result = 0;
if (!ty) {
/* They don't care about the target type, so just pass on the pointer! */
@ -135,8 +136,12 @@ SWIG_ZTS_ConvertResourceData(void * p, const char *type_name, swig_type_info *ty
/* convert and cast p from type_name to ptr as ty. */
tc = SWIG_TypeCheck(type_name, ty);
if (!tc) return NULL;
return SWIG_TypeCast(tc, p);
if (tc) {
int newmemory = 0;
result = SWIG_TypeCast(tc, p, &newmemory);
assert(!newmemory); /* newmemory handling not yet implemented */
}
return result;
}
/* This function returns a pointer of type ty by extracting the pointer

View file

@ -56,7 +56,9 @@ SWIG_Pike_ConvertPtr(struct object *obj, void **ptr, swig_type_info *ty, int fla
if (obj_wrapper && obj_wrapper->type) {
tc = SWIG_TypeCheckStruct(obj_wrapper->type, ty);
if (tc) {
*ptr = SWIG_TypeCast(tc, obj_wrapper->self);
int newmemory = 0;
*ptr = SWIG_TypeCast(tc, obj_wrapper->self, &newmemory);
assert(!newmemory); /* newmemory handling not yet implemented */
return 0;
}
}

View file

@ -14,6 +14,7 @@ extern "C" {
#include <Rdefines.h>
#include <Rversion.h>
#include <stdlib.h>
#include <assert.h>
#define SWIGR 1
@ -289,7 +290,9 @@ SWIG_R_ConvertPtr(SEXP obj, void **ptr, swig_type_info *ty, int flags) {
if (ptr) *ptr = vptr;
} else {
swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
if (ptr) *ptr = SWIG_TypeCast(tc,vptr);
int newmemory = 0;
if (ptr) *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
assert(!newmemory); /* newmemory handling not yet implemented */
}
} else {
if (ptr) *ptr = vptr;

View file

@ -57,6 +57,7 @@
#define SWIG_MangleStr(value) SWIG_Ruby_MangleStr(value)
#define SWIG_CheckConvert(value, ty) SWIG_Ruby_CheckConvert(value, ty)
#include "assert.h"
/* -----------------------------------------------------------------------------
* pointers/data manipulation
@ -318,8 +319,11 @@ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags,
tc = SWIG_TypeCheck(c, ty);
if (!tc) {
return SWIG_ERROR;
} else {
int newmemory = 0;
*ptr = SWIG_TypeCast(tc, vptr, &newmemory);
assert(!newmemory); /* newmemory handling not yet implemented */
}
*ptr = SWIG_TypeCast(tc, vptr);
} else {
*ptr = vptr;
}

View file

@ -70,6 +70,7 @@
#define SWIG_GetConstant SWIG_GetConstantObj
#define SWIG_Tcl_GetConstant SWIG_Tcl_GetConstantObj
#include "assert.h"
#ifdef __cplusplus
extern "C" {
@ -166,7 +167,11 @@ SWIG_Tcl_ConvertPtrFromString(Tcl_Interp *interp, const char *c, void **ptr, swi
if (flags & SWIG_POINTER_DISOWN) {
SWIG_Disown((void *) *ptr);
}
*ptr = SWIG_TypeCast(tc,(void *) *ptr);
{
int newmemory = 0;
*ptr = SWIG_TypeCast(tc,(void *) *ptr,&newmemory);
assert(!newmemory); /* newmemory handling not yet implemented */
}
}
return SWIG_OK;
}