void* used instead of int for IntPtr in C function declarations
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5192 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
e480bac0b3
commit
1035092471
2 changed files with 20 additions and 20 deletions
|
|
@ -68,19 +68,19 @@
|
||||||
%typemap(cstype) char[ANY] "string"
|
%typemap(cstype) char[ANY] "string"
|
||||||
|
|
||||||
/* Non primitive types */
|
/* Non primitive types */
|
||||||
%typemap(ctype) SWIGTYPE "int"
|
%typemap(ctype) SWIGTYPE "void *"
|
||||||
%typemap(imtype) SWIGTYPE "IntPtr"
|
%typemap(imtype) SWIGTYPE "IntPtr"
|
||||||
%typemap(cstype) SWIGTYPE "$&csclassname"
|
%typemap(cstype) SWIGTYPE "$&csclassname"
|
||||||
|
|
||||||
%typemap(ctype) SWIGTYPE [] "int"
|
%typemap(ctype) SWIGTYPE [] "void *"
|
||||||
%typemap(imtype) SWIGTYPE [] "IntPtr"
|
%typemap(imtype) SWIGTYPE [] "IntPtr"
|
||||||
%typemap(cstype) SWIGTYPE [] "$csclassname"
|
%typemap(cstype) SWIGTYPE [] "$csclassname"
|
||||||
|
|
||||||
%typemap(ctype) SWIGTYPE * "int"
|
%typemap(ctype) SWIGTYPE * "void *"
|
||||||
%typemap(imtype) SWIGTYPE * "IntPtr"
|
%typemap(imtype) SWIGTYPE * "IntPtr"
|
||||||
%typemap(cstype) SWIGTYPE * "$csclassname"
|
%typemap(cstype) SWIGTYPE * "$csclassname"
|
||||||
|
|
||||||
%typemap(ctype) SWIGTYPE & "int"
|
%typemap(ctype) SWIGTYPE & "void *"
|
||||||
%typemap(imtype) SWIGTYPE & "IntPtr"
|
%typemap(imtype) SWIGTYPE & "IntPtr"
|
||||||
%typemap(cstype) SWIGTYPE & "$csclassname"
|
%typemap(cstype) SWIGTYPE & "$csclassname"
|
||||||
|
|
||||||
|
|
@ -175,34 +175,36 @@ $1 = &temp; %}
|
||||||
|
|
||||||
/* Default handling. Object passed by value. Convert to a pointer */
|
/* Default handling. Object passed by value. Convert to a pointer */
|
||||||
%typemap(in) SWIGTYPE ($&1_type argp)
|
%typemap(in) SWIGTYPE ($&1_type argp)
|
||||||
%{ argp = *($&1_ltype*)&$input;
|
%{ argp = ($&1_ltype)$input;
|
||||||
if (!argp) {
|
if (!argp) {
|
||||||
SWIG_CSharpThrowException(SWIG_CSharpNullReferenceException, "Attempt to dereference null $1_type");
|
SWIG_CSharpThrowException(SWIG_CSharpNullReferenceException, "Attempt to dereference null $1_type");
|
||||||
}
|
}
|
||||||
$1 = *argp; %}
|
$1 = *argp; %}
|
||||||
%typemap(out) SWIGTYPE
|
%typemap(out) SWIGTYPE
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
%{*($&1_ltype*)&$result = new $1_ltype(($1_ltype &)$1); %}
|
%{$result = new $1_ltype(($1_ltype &)$1); %}
|
||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
$&1_ltype $1ptr = ($&1_ltype) malloc(sizeof($1_ltype));
|
$&1_ltype $1ptr = ($&1_ltype) malloc(sizeof($1_ltype));
|
||||||
memmove($1ptr, &$1, sizeof($1_type));
|
memmove($1ptr, &$1, sizeof($1_type));
|
||||||
*($&1_ltype*)&$result = $1ptr;
|
$result = $1ptr;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Generic pointers and references */
|
/* Generic pointers and references */
|
||||||
%typemap(in) SWIGTYPE *, SWIGTYPE (CLASS::*) %{ $1 = *($&1_ltype)&$input; %}
|
%typemap(in) SWIGTYPE * %{ $1 = ($1_ltype)$input; %}
|
||||||
%typemap(in) SWIGTYPE & %{ $1 = *($&1_ltype)&$input;
|
%typemap(in) SWIGTYPE (CLASS::*) %{ $1 = *($&1_ltype)&$input; %}
|
||||||
|
%typemap(in) SWIGTYPE & %{ $1 = ($1_ltype)$input;
|
||||||
if(!$1) {
|
if(!$1) {
|
||||||
SWIG_CSharpThrowException(SWIG_CSharpNullReferenceException, "$1_type reference is null");
|
SWIG_CSharpThrowException(SWIG_CSharpNullReferenceException, "$1_type reference is null");
|
||||||
} %}
|
} %}
|
||||||
%typemap(out) SWIGTYPE *, SWIGTYPE &, SWIGTYPE (CLASS::*) %{ *($&1_ltype)&$result = $1; %}
|
%typemap(out) SWIGTYPE *, SWIGTYPE & %{ $result = (void *)$1; %}
|
||||||
|
%typemap(out) SWIGTYPE (CLASS::*) %{ *($&1_ltype)&$result = $1; %}
|
||||||
|
|
||||||
|
|
||||||
/* Default array handling */
|
/* Default array handling */
|
||||||
%typemap(in) SWIGTYPE [] %{ $1 = *($&1_ltype)&$input; %}
|
%typemap(in) SWIGTYPE [] %{ $1 = ($1_ltype)$input; %}
|
||||||
%typemap(out) SWIGTYPE [] %{ *($&1_ltype)&$result = $1; %}
|
%typemap(out) SWIGTYPE [] %{ $result = $1; %}
|
||||||
|
|
||||||
/* char[ANY] - treat as String */
|
/* char[ANY] - treat as String */
|
||||||
%typemap(in) char[ANY] %{ $1 = $input; %}
|
%typemap(in) char[ANY] %{ $1 = $input; %}
|
||||||
|
|
@ -423,8 +425,8 @@ $1 = &temp; %}
|
||||||
|
|
||||||
%typemap(csdestruct, methodname="Dispose") SWIGTYPE {
|
%typemap(csdestruct, methodname="Dispose") SWIGTYPE {
|
||||||
if(swigCPtr != IntPtr.Zero && swigCMemOwn) {
|
if(swigCPtr != IntPtr.Zero && swigCMemOwn) {
|
||||||
$imcall;
|
|
||||||
swigCMemOwn = false;
|
swigCMemOwn = false;
|
||||||
|
$imcall;
|
||||||
}
|
}
|
||||||
swigCPtr = IntPtr.Zero;
|
swigCPtr = IntPtr.Zero;
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
|
|
@ -432,8 +434,8 @@ $1 = &temp; %}
|
||||||
|
|
||||||
%typemap(csdestruct_derived, methodname="Dispose") SWIGTYPE {
|
%typemap(csdestruct_derived, methodname="Dispose") SWIGTYPE {
|
||||||
if(swigCPtr != IntPtr.Zero && swigCMemOwn) {
|
if(swigCPtr != IntPtr.Zero && swigCMemOwn) {
|
||||||
$imcall;
|
|
||||||
swigCMemOwn = false;
|
swigCMemOwn = false;
|
||||||
|
$imcall;
|
||||||
}
|
}
|
||||||
swigCPtr = IntPtr.Zero;
|
swigCPtr = IntPtr.Zero;
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
|
|
|
||||||
|
|
@ -1080,11 +1080,9 @@ class CSHARP : public Language {
|
||||||
Replaceall(imclass_cppcasts_code, "$baseclass", baseclass);
|
Replaceall(imclass_cppcasts_code, "$baseclass", baseclass);
|
||||||
|
|
||||||
Printv(upcasts_code,
|
Printv(upcasts_code,
|
||||||
"DllExport long SWIGSTDCALL CSharp_$imclazznameTo$imbaseclass",
|
"DllExport $cbaseclass * SWIGSTDCALL CSharp_$imclazznameTo$imbaseclass",
|
||||||
"(long objectRef) {\n",
|
"($cclass *objectRef) {\n",
|
||||||
" long baseptr = 0;\n"
|
" return ($cbaseclass *)objectRef;\n"
|
||||||
" *($cbaseclass **)&baseptr = *($cclass **)&objectRef;\n"
|
|
||||||
" return baseptr;\n"
|
|
||||||
"}\n",
|
"}\n",
|
||||||
"\n",
|
"\n",
|
||||||
NIL);
|
NIL);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue