1 /* ----------------------------------------------------------------------------- 2 * --- Input arguments --- 3 * ----------------------------------------------------------------------------- */ 4 /* Pointers and arrays */ 5 %typemap(in, noblock=1) SWIGTYPE *(void *argp = 0, int res = 0) { 6 res = SWIG_ConvertPtr($input, &argp,$descriptor, $disown | %convertptr_flags); 7 if (!SWIG_IsOK(res)) { 8 %argument_fail(res, "$type", $symname, $argnum); 9 } 10 $1 = %reinterpret_cast(argp, $ltype); 11 } 12 %typemap(freearg) SWIGTYPE * ""; 13 14 %typemap(in, noblock=1) SWIGTYPE [] (void *argp = 0, int res = 0) { 15 res = SWIG_ConvertPtr($input, &argp,$descriptor, $disown | %convertptr_flags); 16 if (!SWIG_IsOK(res)) { 17 %argument_fail(res, "$type", $symname, $argnum); 18 } 19 $1 = %reinterpret_cast(argp, $ltype); 20 } 21 %typemap(freearg) SWIGTYPE [] ""; 22 23 24 %typemap(in, noblock=1) SWIGTYPE *const& (void *argp = 0, int res = 0, $*1_ltype temp) { 25 res = SWIG_ConvertPtr($input, &argp, $*descriptor, $disown | %convertptr_flags); 26 if (!SWIG_IsOK(res)) { 27 %argument_fail(res, "$*ltype", $symname, $argnum); 28 } 29 temp = %reinterpret_cast(argp, $*ltype); 30 $1 = %reinterpret_cast(&temp, $1_ltype); 31 } 32 %typemap(freearg) SWIGTYPE *const& ""; 33 34 35 /* Reference */ 36 %typemap(in, noblock=1) SWIGTYPE & (void *argp = 0, int res = 0) { 37 res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags); 38 if (!SWIG_IsOK(res)) { 39 %argument_fail(res, "$type", $symname, $argnum); 40 } 41 if (!argp) { %argument_nullref("$type", $symname, $argnum); } 42 $1 = %reinterpret_cast(argp, $ltype); 43 } 44 %typemap(freearg) SWIGTYPE & ""; 45 46 #if defined(__cplusplus) && defined(%implicitconv_flag) 47 %typemap(in,noblock=1,implicitconv=1) const SWIGTYPE & (void *argp = 0, int res = 0) { 48 res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags | %implicitconv_flag); 49 if (!SWIG_IsOK(res)) { 50 %argument_fail(res, "$type", $symname, $argnum); 51 } 52 if (!argp) { %argument_nullref("$type", $symname, $argnum); } 53 $1 = %reinterpret_cast(argp, $ltype); 54 } 55 %typemap(freearg,noblock=1,match="in",implicitconv=1) const SWIGTYPE & 56 { 57 if (SWIG_IsNewObj(res$argnum)) %delete($1); 58 } 59 #else 60 %typemap(in,noblock=1) const SWIGTYPE & (void *argp, int res = 0) { 61 res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags); 62 if (!SWIG_IsOK(res)) { 63 %argument_fail(res, "$type", $symname, $argnum); 64 } 65 if (!argp) { %argument_nullref("$type", $symname, $argnum); } 66 $1 = %reinterpret_cast(argp, $ltype); 67 } 68 #endif 69 70 /* By value */ 71 #if defined(__cplusplus) && defined(%implicitconv_flag) 72 %typemap(in,implicitconv=1) SWIGTYPE (void *argp, int res = 0) { 73 res = SWIG_ConvertPtr($input, &argp, $&descriptor, %convertptr_flags | %implicitconv_flag); 74 if (!SWIG_IsOK(res)) { 75 %argument_fail(res, "$type", $symname, $argnum); 76 } 77 if (!argp) { 78 %argument_nullref("$type", $symname, $argnum); 79 } else { 80 $<ype temp = %reinterpret_cast(argp, $<ype); 81 $1 = *temp; 82 if (SWIG_IsNewObj(res)) %delete(temp); 83 } 84 } 85 #else 86 %typemap(in) SWIGTYPE (void *argp, int res = 0) { 87 res = SWIG_ConvertPtr($input, &argp, $&descriptor, %convertptr_flags); 88 if (!SWIG_IsOK(res)) { 89 %argument_fail(res, "$type", $symname, $argnum); 90 } 91 if (!argp) { 92 %argument_nullref("$type", $symname, $argnum); 93 } else { 94 $1 = *(%reinterpret_cast(argp, $<ype)); 95 } 96 } 97 #endif 98 99 100 /* ----------------------------------------------------------------------------- 101 * --- Output arguments --- 102 * ----------------------------------------------------------------------------- */ 103 104 /* Pointers, references */ 105 %typemap(out,noblock=1) SWIGTYPE *, SWIGTYPE &, SWIGTYPE[] { 106 %set_output(SWIG_NewPointerObj(%as_voidptr($1), $descriptor, $owner | %newpointer_flags)); 107 } 108 109 %typemap(out, noblock=1) SWIGTYPE *const& { 110 %set_output(SWIG_NewPointerObj(%as_voidptr(*$1), $*descriptor, $owner | %newpointer_flags)); 111 } 112 113 /* Return by value */ 114 %typemap(out, noblock=1) SWIGTYPE { 115 %set_output(SWIG_NewPointerObj(%new_copy($1, $ltype), $&descriptor, SWIG_POINTER_OWN | %newpointer_flags)); 116 } 117 118 /* ----------------------------------------------------------------------------- 119 * --- Variable input --- 120 * ----------------------------------------------------------------------------- */ 121 122 /* memberin/globalin/varin, for fix arrays. */ 123 124 %typemap(memberin) SWIGTYPE [ANY] { 125 if ($input) { 126 size_t ii = 0; 127 for (; ii < (size_t)$1_dim0; ++ii) $1[ii] = $input[ii]; 128 } else { 129 %variable_nullref("$type","$name"); 130 } 131 } 132 133 %typemap(globalin) SWIGTYPE [ANY] { 134 if ($input) { 135 size_t ii = 0; 136 for (; ii < (size_t)$1_dim0; ++ii) $1[ii] = $input[ii]; 137 } else { 138 %variable_nullref("$type","$name"); 139 } 140 } 141 142 %typemap(varin) SWIGTYPE [ANY] { 143 $basetype *inp = 0; 144 int res = SWIG_ConvertPtr($input, %as_voidptrptr(&inp), $descriptor, %convertptr_flags); 145 if (!SWIG_IsOK(res)) { 146 %variable_fail(res, "$type", "$name"); 147 } else if (inp) { 148 size_t ii = 0; 149 for (; ii < (size_t)$1_dim0; ++ii) $1[ii] = inp[ii]; 150 } else { 151 %variable_nullref("$type", "$name"); 152 } 153 } 154 155 156 /* memberin/globalin/varin, for fix double arrays. */ 157 158 %typemap(memberin) SWIGTYPE [ANY][ANY] { 159 if ($input) { 160 size_t ii = 0; 161 for (; ii < (size_t)$1_dim0; ++ii) { 162 if ($input[ii]) { 163 size_t jj = 0; 164 for (; jj < (size_t)$1_dim1; ++jj) $1[ii][jj] = $input[ii][jj]; 165 } else { 166 %variable_nullref("$type","$name"); 167 } 168 } 169 } else { 170 %variable_nullref("$type","$name"); 171 } 172 } 173 174 %typemap(globalin) SWIGTYPE [ANY][ANY] { 175 if ($input) { 176 size_t ii = 0; 177 for (; ii < (size_t)$1_dim0; ++ii) { 178 if ($input[ii]) { 179 size_t jj = 0; 180 for (; jj < (size_t)$1_dim1; ++jj) $1[ii][jj] = $input[ii][jj]; 181 } else { 182 %variable_nullref("$type","$name"); 183 } 184 } 185 } else { 186 %variable_nullref("$type","$name"); 187 } 188 } 189 190 %typemap(varin) SWIGTYPE [ANY][ANY] { 191 $basetype (*inp)[$1_dim1] = 0; 192 int res = SWIG_ConvertPtr($input, %as_voidptrptr(&inp), $descriptor, %convertptr_flags); 193 if (!SWIG_IsOK(res)) { 194 %variable_fail(res, "$type", "$name"); 195 } else if (inp) { 196 size_t ii = 0; 197 for (; ii < (size_t)$1_dim0; ++ii) { 198 if (inp[ii]) { 199 size_t jj = 0; 200 for (; jj < (size_t)$1_dim1; ++jj) $1[ii][jj] = inp[ii][jj]; 201 } else { 202 %variable_nullref("$type", "$name"); 203 } 204 } 205 } else { 206 %variable_nullref("$type", "$name"); 207 } 208 } 209 210 /* Pointers, references, and variable size arrays */ 211 212 %typemap(varin,warning=SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) SWIGTYPE * { 213 void *argp = 0; 214 int res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags); 215 if (!SWIG_IsOK(res)) { 216 %variable_fail(res, "$type", "$name"); 217 } 218 $1 = %reinterpret_cast(argp, $ltype); 219 } 220 221 %typemap(varin,noblock=1,warning="462:Unable to set dimensionless array variable") SWIGTYPE [] 222 { 223 %variable_fail(SWIG_AttributeError, "$type", "read-only $name"); 224 } 225 226 %typemap(varin,warning=SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) SWIGTYPE & { 227 void *argp = 0; 228 int res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags); 229 if (!SWIG_IsOK(res)) { 230 %variable_fail(res, "$type", "$name"); 231 } 232 if (!argp) { 233 %variable_nullref("$type", "$name"); 234 } 235 $1 = *(%reinterpret_cast(argp, $ltype)); 236 } 237 238 #if defined(__cplusplus) && defined(%implicitconv_flag) 239 %typemap(varin,implicitconv=1) SWIGTYPE { 240 void *argp = 0; 241 int res = SWIG_ConvertPtr($input, &argp, $&descriptor, %convertptr_flags | %implicitconv_flag); 242 if (!SWIG_IsOK(res)) { 243 %variable_fail(res, "$type", "$name"); 244 } 245 if (!argp) { 246 %variable_nullref("$type", "$name"); 247 } else { 248 $&type temp; 249 temp = %reinterpret_cast(argp, $&type); 250 $1 = *temp; 251 if (SWIG_IsNewObj(res)) %delete(temp); 252 } 253 } 254 #else 255 %typemap(varin) SWIGTYPE { 256 void *argp = 0; 257 int res = SWIG_ConvertPtr($input, &argp, $&descriptor, %convertptr_flags); 258 if (!SWIG_IsOK(res)) { 259 %variable_fail(res, "$type", "$name"); 260 } 261 if (!argp) { 262 %variable_nullref("$type", "$name"); 263 } else { 264 $1 = *(%reinterpret_cast(argp, $&type)); 265 } 266 } 267 #endif 268 269 /* ----------------------------------------------------------------------------- 270 * --- Variable output --- 271 * ----------------------------------------------------------------------------- */ 272 273 /* Pointers and arrays */ 274 %typemap(varout, noblock=1) SWIGTYPE * { 275 %set_varoutput(SWIG_NewPointerObj(%as_voidptr($1), $descriptor, %newpointer_flags)); 276 } 277 278 %typemap(varout, noblock=1) SWIGTYPE [] { 279 %set_varoutput(SWIG_NewPointerObj(%as_voidptr($1), $descriptor, %newpointer_flags)); 280 } 281 282 /* References */ 283 %typemap(varout, noblock=1) SWIGTYPE & { 284 %set_varoutput(SWIG_NewPointerObj(%as_voidptr(&$1), $descriptor, %newpointer_flags)); 285 } 286 287 /* Value */ 288 %typemap(varout, noblock=1) SWIGTYPE { 289 %set_varoutput(SWIG_NewPointerObj(%as_voidptr(&$1), $&descriptor, %newpointer_flags)); 290 } 291 292 /* ------------------------------------------------------------ 293 * --- Typechecking rules --- 294 * ------------------------------------------------------------ */ 295 296 %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE * { 297 void *vptr = 0; 298 int res = SWIG_ConvertPtr($input, &vptr, $descriptor, 0); 299 $1 = SWIG_CheckState(res); 300 } 301 302 %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE *const& { 303 void *vptr = 0; 304 int res = SWIG_ConvertPtr($input, &vptr, $*descriptor, 0); 305 $1 = SWIG_CheckState(res); 306 } 307 308 %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE & { 309 void *vptr = 0; 310 int res = SWIG_ConvertPtr($input, &vptr, $descriptor, 0); 311 $1 = SWIG_CheckState(res); 312 } 313 314 #if defined(__cplusplus) && defined(%implicitconv_flag) 315 %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1,implicitconv=1) const SWIGTYPE & { 316 int res = SWIG_ConvertPtr($input, 0, $descriptor, %implicitconv_flag); 317 $1 = SWIG_CheckState(res); 318 } 319 320 %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1,implicitconv=1) SWIGTYPE { 321 int res = SWIG_ConvertPtr($input, 0, $&descriptor, %implicitconv_flag); 322 $1 = SWIG_CheckState(res); 323 } 324 #else 325 %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) const SWIGTYPE & { 326 void *vptr = 0; 327 int res = SWIG_ConvertPtr($input, &vptr, $descriptor, 0); 328 $1 = SWIG_CheckState(res); 329 } 330 331 %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE { 332 void *vptr = 0; 333 int res = SWIG_ConvertPtr($input, &vptr, $&descriptor, 0); 334 $1 = SWIG_CheckState(res); 335 } 336 #endif 337 338 /* ----------------------------------------------------------------------------- 339 * --- Director typemaps --- * 340 * ----------------------------------------------------------------------------- */ 341 342 #if defined(SWIG_DIRECTOR_TYPEMAPS) 343 344 /* directorin */ 345 346 %typemap(directorin,noblock=1) SWIGTYPE *, SWIGTYPE *const& { 347 $input = SWIG_NewPointerObj(%as_voidptr($1), $descriptor, %newpointer_flags); 348 } 349 350 %typemap(directorin,noblock=1) SWIGTYPE { 351 $input = SWIG_NewPointerObj(%as_voidptr(&$1), $&descriptor, %newpointer_flags); 352 } 353 354 %typemap(directorin,noblock=1) SWIGTYPE & { 355 $input = SWIG_NewPointerObj(%as_voidptr(&$1), $descriptor, %newpointer_flags); 356 } 357 358 /* directorout */ 359 #if defined(__cplusplus) && defined(%implicitconv_flag) 360 %typemap(directorout,noblock=1,implicitconv=1) SWIGTYPE (void * swig_argp, int swig_res = 0) { 361 swig_res = SWIG_ConvertPtr($input,&swig_argp,$&descriptor, %convertptr_flags | %implicitconv_flag); 362 if (!SWIG_IsOK(swig_res)) { 363 %dirout_fail(swig_res,"$type"); 364 } 365 $result = *(%reinterpret_cast(swig_argp, $<ype)); 366 if (SWIG_IsNewObj(swig_res)) %delete(%reinterpret_cast(swig_argp, $<ype)); 367 } 368 #else 369 %typemap(directorout,noblock=1) SWIGTYPE (void * swig_argp, int swig_res = 0) { 370 swig_res = SWIG_ConvertPtr($input,&swig_argp,$&descriptor, %convertptr_flags); 371 if (!SWIG_IsOK(swig_res)) { 372 %dirout_fail(swig_res,"$type"); 373 } 374 $result = *(%reinterpret_cast(swig_argp, $<ype)); 375 } 376 #endif 377 378 %typemap(directorout,noblock=1,warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) 379 SWIGTYPE *(void *swig_argp, int swig_res, swig_owntype own) { 380 swig_res = SWIG_ConvertPtrAndOwn($input, &swig_argp, $descriptor, %convertptr_flags | SWIG_POINTER_DISOWN, &own); 381 if (!SWIG_IsOK(swig_res)) { 382 %dirout_fail(swig_res,"$type"); 383 } 384 $result = %reinterpret_cast(swig_argp, $ltype); 385 swig_acquire_ownership_obj(%as_voidptr($result), own /* & TODO: SWIG_POINTER_OWN */); 386 } 387 %typemap(directorfree,noblock=1,match="directorout") SWIGTYPE * { 388 if (director) { 389 SWIG_AcquirePtr($result, director->swig_release_ownership(%as_voidptr($input))); 390 } 391 } 392 393 %typemap(directorout,noblock=1,warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) 394 SWIGTYPE &(void *swig_argp, int swig_res, swig_owntype own) { 395 swig_res = SWIG_ConvertPtrAndOwn($input, &swig_argp, $descriptor, %convertptr_flags | SWIG_POINTER_DISOWN, &own); 396 if (!SWIG_IsOK(swig_res)) { 397 %dirout_fail(swig_res,"$type"); 398 } 399 if (!swig_argp) { %dirout_nullref("$type"); } 400 $result = %reinterpret_cast(swig_argp, $ltype); 401 swig_acquire_ownership_obj(%as_voidptr($result), own /* & TODO: SWIG_POINTER_OWN */); 402 } 403 %typemap(directorfree,noblock=1,match="directorout") SWIGTYPE & { 404 if (director) { 405 SWIG_AcquirePtr($result, director->swig_release_ownership(%as_voidptr($input))); 406 } 407 } 408 409 #endif /* SWIG_DIRECTOR_TYPEMAPS */ 410 411 412 /* ------------------------------------------------------------ 413 * --- Constants --- 414 * ------------------------------------------------------------ */ 415 416 %typemap(constcode,noblock=1) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] { 417 %set_constant("$symname", SWIG_NewPointerObj(%as_voidptr($value),$descriptor,%newpointer_flags)); 418 } 419 420 %typemap(constcode,noblock=1) SWIGTYPE { 421 %set_constant("$symname", SWIG_NewPointerObj(%as_voidptr(&$value),$&descriptor,%newpointer_flags)); 422 } 423 424 /* ------------------------------------------------------------ 425 * --- Exception handling --- 426 * ------------------------------------------------------------ */ 427 428 %typemap(throws,noblock=1) SWIGTYPE { 429 %raise(SWIG_NewPointerObj(%new_copy($1, $ltype),$&descriptor,SWIG_POINTER_OWN), "$type", $&descriptor); 430 } 431 432 %typemap(throws,noblock=1) SWIGTYPE * { 433 %raise(SWIG_NewPointerObj(%as_voidptr($1),$descriptor,0), "$type", $descriptor); 434 } 435 436 %typemap(throws,noblock=1) SWIGTYPE [ANY] { 437 %raise(SWIG_NewPointerObj(%as_voidptr($1),$descriptor,0), "$type", $descriptor); 438 } 439 440 %typemap(throws,noblock=1) SWIGTYPE & { 441 %raise(SWIG_NewPointerObj(%as_voidptr(&$1),$descriptor,0), "$type", $descriptor); 442 } 443 444 %typemap(throws,noblock=1) (...) { 445 SWIG_exception_fail(SWIG_RuntimeError,"unknown exception"); 446 } 447 448 /* ------------------------------------------------------------ 449 * --- CLASS::* typemaps --- 450 * ------------------------------------------------------------ */ 451 452 %typemap(in) SWIGTYPE (CLASS::*) { 453 int res = SWIG_ConvertMember($input, %as_voidptr(&$1), sizeof($type),$descriptor); 454 if (!SWIG_IsOK(res)) { 455 %argument_fail(res,"$type",$symname, $argnum); 456 } 457 } 458 459 %typemap(out,noblock=1) SWIGTYPE (CLASS::*) { 460 %set_output(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($type), $descriptor)); 461 } 462 463 %typemap(varin) SWIGTYPE (CLASS::*) { 464 int res = SWIG_ConvertMember($input,%as_voidptr(&$1), sizeof($type), $descriptor); 465 if (!SWIG_IsOK(res)) { 466 %variable_fail(res, "$type", "$name"); 467 } 468 } 469 470 %typemap(varout,noblock=1) SWIGTYPE (CLASS::*) { 471 %set_varoutput(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($type), $descriptor)); 472 } 473 474 %typemap(constcode,noblock=1) SWIGTYPE (CLASS::*) { 475 %set_constant("$symname", SWIG_NewMemberObj(%as_voidptr(&$value), sizeof($type), $descriptor)); 476 } 477 478 #if defined(SWIG_DIRECTOR_TYPEMAPS) 479 480 /* directorin */ 481 482 %typemap(directorin,noblock=1) SWIGTYPE (CLASS::*) { 483 $input = SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($type), $descriptor); 484 } 485 486 /* directorout */ 487 488 %typemap(directorout) SWIGTYPE (CLASS::*) { 489 int swig_res = SWIG_ConvertMember($input,%as_voidptr(&$result), sizeof($type), $descriptor); 490 if (!SWIG_IsOK(swig_res)) { 491 %dirout_fail(swig_res,"$type"); 492 } 493 } 494 #endif 495 496 /* ------------------------------------------------------------ 497 * --- function ptr typemaps --- 498 * ------------------------------------------------------------ */ 499 500 /* 501 ISO C++ doesn't allow direct casting of a function ptr to a object 502 ptr. So, maybe the ptr sizes are not the same, and we need to take 503 some providences. 504 */ 505 %typemap(in) SWIGTYPE ((*)(ANY)) { 506 int res = SWIG_ConvertFunctionPtr($input, (void**)(&$1), $descriptor); 507 if (!SWIG_IsOK(res)) { 508 %argument_fail(res,"$type",$symname, $argnum); 509 } 510 } 511 512 %typecheck(SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE ((*)(ANY)) { 513 void *ptr = 0; 514 int res = SWIG_ConvertFunctionPtr($input, &ptr, $descriptor); 515 $1 = SWIG_CheckState(res); 516 } 517 518 519 %typemap(out, noblock=1) SWIGTYPE ((*)(ANY)) { 520 %set_output(SWIG_NewFunctionPtrObj((void *)($1), $descriptor)); 521 } 522 523 %typemap(varin) SWIGTYPE ((*)(ANY)) { 524 int res = SWIG_ConvertFunctionPtr($input, (void**)(&$1), $descriptor); 525 if (!SWIG_IsOK(res)) { 526 %variable_fail(res, "$type", "$name"); 527 } 528 } 529 530 %typemap(varout,noblock=1) SWIGTYPE ((*)(ANY)) { 531 %set_varoutput(SWIG_NewFunctionPtrObj((void *)($1), $descriptor)); 532 } 533 534 %typemap(constcode, noblock=1) SWIGTYPE ((*)(ANY)){ 535 %set_constant("$symname", SWIG_NewFunctionPtrObj((void *)$value, $descriptor)); 536 } 537 538 #if defined(SWIG_DIRECTOR_TYPEMAPS) 539 540 /* directorin */ 541 542 %typemap(directorin,noblock=1) SWIGTYPE ((*)(ANY)) { 543 $input = SWIG_NewFunctionPtrObj((void*)($1), $descriptor); 544 } 545 546 /* directorout */ 547 548 %typemap(directorout) SWIGTYPE ((*)(ANY)) { 549 int swig_res = SWIG_ConvertFunctionPtr($input,(void**)(&$result),$descriptor); 550 if (!SWIG_IsOK(swig_res)) { 551 %dirout_fail(swig_res,"$type"); 552 } 553 } 554 #endif 555 556 %apply SWIGTYPE * { SWIGTYPE *const } 557 558 /* ------------------------------------------------------------ 559 * --- Special typemaps --- 560 * ------------------------------------------------------------ */ 561 562 /* DISOWN typemap */ 563 564 %typemap(in, noblock=1) SWIGTYPE *DISOWN (int res = 0) { 565 res = SWIG_ConvertPtr($input, %as_voidptrptr(&$1), $descriptor, SWIG_POINTER_DISOWN | %convertptr_flags); 566 if (!SWIG_IsOK(res)) { 567 %argument_fail(res,"$type", $symname, $argnum); 568 } 569 } 570 571 %typemap(varin) SWIGTYPE *DISOWN { 572 void *temp = 0; 573 int res = SWIG_ConvertPtr($input, &temp, $descriptor, SWIG_POINTER_DISOWN | %convertptr_flags); 574 if (!SWIG_IsOK(res)) { 575 %variable_fail(res, "$type", "$name"); 576 } 577 $1 = ($ltype) temp; 578 } 579 580 /* DYNAMIC typemap */ 581 582 %typemap(out,noblock=1) SWIGTYPE *DYNAMIC, SWIGTYPE &DYNAMIC { 583 %set_output(SWIG_NewPointerObj(%as_voidptr($1), SWIG_TypeDynamicCast($descriptor, %as_voidptrptr(&$1)), $owner | %newpointer_flags)); 584 } 585 586 /* INSTANCE typemap */ 587 588 %typemap(out,noblock=1) SWIGTYPE INSTANCE { 589 %set_output(SWIG_NewInstanceObj(%new_copy($1, $1_ltype), $&1_descriptor, SWIG_POINTER_OWN | %newinstance_flags)); 590 } 591 592 %typemap(out,noblock=1) SWIGTYPE *INSTANCE, SWIGTYPE &INSTANCE, SWIGTYPE INSTANCE[] { 593 %set_output(SWIG_NewInstanceObj(%as_voidptr($1), $1_descriptor, $owner | %newinstance_flags)); 594 } 595 596 %typemap(varout,noblock=1) SWIGTYPE *INSTANCE, SWIGTYPE INSTANCE[] { 597 %set_varoutput(SWIG_NewInstanceObj(%as_voidptr($1), $1_descriptor, %newinstance_flags)); 598 } 599 600 %typemap(varout,noblock=1) SWIGTYPE &INSTANCE { 601 %set_varoutput(SWIG_NewInstanceObj(%as_voidptr($1), $1_descriptor, %newinstance_flags)); 602 } 603 604 %typemap(varout,noblock=1) SWIGTYPE INSTANCE { 605 %set_varoutput(SWIG_NewInstanceObj(%as_voidptr(&$1), $&1_descriptor, %newinstance_flags)); 606 } 607 608