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) { if (type) {
cast = SWIG_TypeCheckStruct(from, type); cast = SWIG_TypeCheckStruct(from, type);
if (cast) { 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 { } else {
return 1; return 1;
} }

View file

@ -12,6 +12,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <assert.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -161,7 +162,9 @@ SWIG_Guile_ConvertPtr(swig_module_info *module, SCM s, void **result,
if (type) { if (type) {
cast = SWIG_TypeCheckStruct(from, type); cast = SWIG_TypeCheckStruct(from, type);
if (cast) { 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; return SWIG_OK;
} else { } else {
return SWIG_ERROR; return SWIG_ERROR;

View file

@ -9,6 +9,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <assert.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -163,7 +164,9 @@ SWIG_Guile_ConvertPtr(SCM s, void **result, swig_type_info *type, int flags)
if (type) { if (type) {
cast = SWIG_TypeCheckStruct(from, type); cast = SWIG_TypeCheckStruct(from, type);
if (cast) { 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; return SWIG_OK;
} else { } else {
return SWIG_ERROR; 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 */ cast=SWIG_TypeCheckStruct(usr->type,type); /* performs normal type checking */
if (cast) 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 */ return SWIG_OK; /* ok */
} }
} }

View file

@ -10,6 +10,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <limits.h> #include <limits.h>
#include <escheme.h> #include <escheme.h>
#include <assert.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -167,7 +168,9 @@ SWIG_MzScheme_ConvertPtr(Scheme_Object *s, void **result, swig_type_info *type,
if (type) { if (type) {
cast = SWIG_TypeCheckStruct(proxy->type, type); cast = SWIG_TypeCheckStruct(proxy->type, type);
if (cast) { 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; return 0;
} else { } else {
return 1; return 1;

View file

@ -65,7 +65,9 @@ extern "C" {
tc ? tc->str : "<none>" ); tc ? tc->str : "<none>" );
#endif #endif
if( tc ) { 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; return 0;
} else } else
return -1; return -1;

View file

@ -265,7 +265,11 @@ SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *
if (!tc) { if (!tc) {
return SWIG_ERROR; 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 { } else {
*ptr = voidptr; *ptr = voidptr;
} }

View file

@ -122,6 +122,7 @@ SWIG_ZTS_SetPointerZval(zval *z, void *ptr, swig_type_info *type, int newobject
static void * static void *
SWIG_ZTS_ConvertResourceData(void * p, const char *type_name, swig_type_info *ty TSRMLS_DC) { SWIG_ZTS_ConvertResourceData(void * p, const char *type_name, swig_type_info *ty TSRMLS_DC) {
swig_cast_info *tc; swig_cast_info *tc;
void *result = 0;
if (!ty) { if (!ty) {
/* They don't care about the target type, so just pass on the pointer! */ /* 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. */ /* convert and cast p from type_name to ptr as ty. */
tc = SWIG_TypeCheck(type_name, ty); tc = SWIG_TypeCheck(type_name, ty);
if (!tc) return NULL; if (tc) {
return SWIG_TypeCast(tc, p); 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 /* 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) { if (obj_wrapper && obj_wrapper->type) {
tc = SWIG_TypeCheckStruct(obj_wrapper->type, ty); tc = SWIG_TypeCheckStruct(obj_wrapper->type, ty);
if (tc) { 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; return 0;
} }
} }

View file

@ -14,6 +14,7 @@ extern "C" {
#include <Rdefines.h> #include <Rdefines.h>
#include <Rversion.h> #include <Rversion.h>
#include <stdlib.h> #include <stdlib.h>
#include <assert.h>
#define SWIGR 1 #define SWIGR 1
@ -289,7 +290,9 @@ SWIG_R_ConvertPtr(SEXP obj, void **ptr, swig_type_info *ty, int flags) {
if (ptr) *ptr = vptr; if (ptr) *ptr = vptr;
} else { } else {
swig_cast_info *tc = SWIG_TypeCheck(to->name,ty); 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 { } else {
if (ptr) *ptr = vptr; if (ptr) *ptr = vptr;

View file

@ -57,6 +57,7 @@
#define SWIG_MangleStr(value) SWIG_Ruby_MangleStr(value) #define SWIG_MangleStr(value) SWIG_Ruby_MangleStr(value)
#define SWIG_CheckConvert(value, ty) SWIG_Ruby_CheckConvert(value, ty) #define SWIG_CheckConvert(value, ty) SWIG_Ruby_CheckConvert(value, ty)
#include "assert.h"
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* pointers/data manipulation * 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); tc = SWIG_TypeCheck(c, ty);
if (!tc) { if (!tc) {
return SWIG_ERROR; 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 { } else {
*ptr = vptr; *ptr = vptr;
} }

View file

@ -70,6 +70,7 @@
#define SWIG_GetConstant SWIG_GetConstantObj #define SWIG_GetConstant SWIG_GetConstantObj
#define SWIG_Tcl_GetConstant SWIG_Tcl_GetConstantObj #define SWIG_Tcl_GetConstant SWIG_Tcl_GetConstantObj
#include "assert.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -166,7 +167,11 @@ SWIG_Tcl_ConvertPtrFromString(Tcl_Interp *interp, const char *c, void **ptr, swi
if (flags & SWIG_POINTER_DISOWN) { if (flags & SWIG_POINTER_DISOWN) {
SWIG_Disown((void *) *ptr); 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; return SWIG_OK;
} }