OLD | NEW |
(Empty) | |
| 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, $*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 = &temp; |
| 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 | %implici
tconv_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 | %implic
itconv_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 | %newpoin
ter_flags)); |
| 107 } |
| 108 |
| 109 %typemap(out, noblock=1) SWIGTYPE* const& { |
| 110 %set_output(SWIG_NewPointerObj(%as_voidptr(*$1), $*descriptor, $owner | %newpo
inter_flags)); |
| 111 } |
| 112 |
| 113 /* Return by value */ |
| 114 %typemap(out, noblock=1) SWIGTYPE { |
| 115 %set_output(SWIG_NewPointerObj(%new_copy($1, $ltype), $&descriptor, SWIG_POINT
ER_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, %convertp
tr_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, %convertp
tr_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 | %im
plicitconv_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_fl
ags)); |
| 276 } |
| 277 |
| 278 %typemap(varout, noblock=1) SWIGTYPE [] { |
| 279 %set_varoutput(SWIG_NewPointerObj(%as_voidptr($1), $descriptor, %newpointer_fl
ags)); |
| 280 } |
| 281 |
| 282 /* References */ |
| 283 %typemap(varout, noblock=1) SWIGTYPE & { |
| 284 %set_varoutput(SWIG_NewPointerObj(%as_voidptr(&$1), $descriptor, %newpointer_f
lags)); |
| 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 & { |
| 303 void *vptr = 0; |
| 304 int res = SWIG_ConvertPtr($input, &vptr, $descriptor, 0); |
| 305 $1 = SWIG_CheckState(res); |
| 306 } |
| 307 |
| 308 #if defined(__cplusplus) && defined(%implicitconv_flag) |
| 309 %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1,implicitconv=1) c
onst SWIGTYPE & { |
| 310 int res = SWIG_ConvertPtr($input, 0, $descriptor, %implicitconv_flag); |
| 311 $1 = SWIG_CheckState(res); |
| 312 } |
| 313 |
| 314 %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1,implicitconv=1) S
WIGTYPE { |
| 315 int res = SWIG_ConvertPtr($input, 0, $&descriptor, %implicitconv_flag); |
| 316 $1 = SWIG_CheckState(res); |
| 317 } |
| 318 #else |
| 319 %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) const SWIGTYPE &
{ |
| 320 void *vptr = 0; |
| 321 int res = SWIG_ConvertPtr($input, &vptr, $descriptor, 0); |
| 322 $1 = SWIG_CheckState(res); |
| 323 } |
| 324 |
| 325 %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE { |
| 326 void *vptr = 0; |
| 327 int res = SWIG_ConvertPtr($input, &vptr, $&descriptor, 0); |
| 328 $1 = SWIG_CheckState(res); |
| 329 } |
| 330 #endif |
| 331 |
| 332 /* ----------------------------------------------------------------------------- |
| 333 * --- Director typemaps --- * |
| 334 * -----------------------------------------------------------------------------
*/ |
| 335 |
| 336 #if defined(SWIG_DIRECTOR_TYPEMAPS) |
| 337 |
| 338 /* directorin */ |
| 339 |
| 340 %typemap(directorin,noblock=1) SWIGTYPE*, SWIGTYPE* const& { |
| 341 $input = SWIG_NewPointerObj(%as_voidptr($1_name), $descriptor, %newpointer_fla
gs); |
| 342 } |
| 343 |
| 344 %typemap(directorin,noblock=1) SWIGTYPE { |
| 345 $input = SWIG_NewPointerObj(%as_voidptr(&$1_name), $&descriptor, %newpointer_f
lags); |
| 346 } |
| 347 |
| 348 %typemap(directorin,noblock=1) SWIGTYPE& { |
| 349 $input = SWIG_NewPointerObj(%as_voidptr(&$1_name), $descriptor, %newpointer_fl
ags); |
| 350 } |
| 351 |
| 352 /* directorout */ |
| 353 #if defined(__cplusplus) && defined(%implicitconv_flag) |
| 354 %typemap(directorout,noblock=1,implicitconv=1) SWIGTYPE (void * swig_argp, int s
wig_res = 0) { |
| 355 swig_res = SWIG_ConvertPtr($input,&swig_argp,$&descriptor, %convertptr_flags |
%implicitconv_flag); |
| 356 if (!SWIG_IsOK(swig_res)) { |
| 357 %dirout_fail(swig_res,"$type"); |
| 358 } |
| 359 $result = *(%reinterpret_cast(swig_argp, $<ype)); |
| 360 if (SWIG_IsNewObj(swig_res)) %delete(%reinterpret_cast(swig_argp, $<ype)); |
| 361 } |
| 362 #else |
| 363 %typemap(directorout,noblock=1) SWIGTYPE (void * swig_argp, int swig_res = 0) { |
| 364 swig_res = SWIG_ConvertPtr($input,&swig_argp,$&descriptor, %convertptr_flags); |
| 365 if (!SWIG_IsOK(swig_res)) { |
| 366 %dirout_fail(swig_res,"$type"); |
| 367 } |
| 368 $result = *(%reinterpret_cast(swig_argp, $<ype)); |
| 369 } |
| 370 #endif |
| 371 |
| 372 %typemap(directorout,noblock=1,warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) |
| 373 SWIGTYPE *(void *swig_argp, int swig_res, swig_owntype own) { |
| 374 swig_res = SWIG_ConvertPtrAndOwn($input, &swig_argp, $descriptor, %convertptr_
flags | SWIG_POINTER_DISOWN, &own); |
| 375 if (!SWIG_IsOK(swig_res)) { |
| 376 %dirout_fail(swig_res,"$type"); |
| 377 } |
| 378 $result = %reinterpret_cast(swig_argp, $ltype); |
| 379 swig_acquire_ownership_obj(%as_voidptr($result), own /* & TODO: SWIG_POINTER_O
WN */); |
| 380 } |
| 381 %typemap(directorfree,noblock=1,match="directorout") SWIGTYPE * { |
| 382 if (director) { |
| 383 SWIG_AcquirePtr($result, director->swig_release_ownership(%as_voidptr($input
))); |
| 384 } |
| 385 } |
| 386 |
| 387 %typemap(directorout,noblock=1,warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) |
| 388 SWIGTYPE &(void *swig_argp, int swig_res, swig_owntype own) { |
| 389 swig_res = SWIG_ConvertPtrAndOwn($input, &swig_argp, $descriptor, %convertptr_
flags | SWIG_POINTER_DISOWN, &own); |
| 390 if (!SWIG_IsOK(swig_res)) { |
| 391 %dirout_fail(swig_res,"$type"); |
| 392 } |
| 393 if (!swig_argp) { %dirout_nullref("$type"); } |
| 394 $result = %reinterpret_cast(swig_argp, $ltype); |
| 395 swig_acquire_ownership_obj(%as_voidptr($result), own /* & TODO: SWIG_POINTER_O
WN */); |
| 396 } |
| 397 %typemap(directorfree,noblock=1,match="directorout") SWIGTYPE & { |
| 398 if (director) { |
| 399 SWIG_AcquirePtr($result, director->swig_release_ownership(%as_voidptr($input
))); |
| 400 } |
| 401 } |
| 402 |
| 403 #endif /* SWIG_DIRECTOR_TYPEMAPS */ |
| 404 |
| 405 |
| 406 /* ------------------------------------------------------------ |
| 407 * --- Constants --- |
| 408 * ------------------------------------------------------------ */ |
| 409 |
| 410 %typemap(constcode,noblock=1) SWIGTYPE *, SWIGTYPE &, SWIGTYPE []{ |
| 411 %set_constant("$symname", SWIG_NewPointerObj(%as_voidptr($value),$descriptor,%
newpointer_flags)); |
| 412 } |
| 413 |
| 414 %typemap(constcode,noblock=1) SWIGTYPE { |
| 415 %set_constant("$symname", SWIG_NewPointerObj(%as_voidptr(&$value),$&descriptor
,%newpointer_flags)); |
| 416 } |
| 417 |
| 418 /* ------------------------------------------------------------ |
| 419 * --- Exception handling --- |
| 420 * ------------------------------------------------------------ */ |
| 421 |
| 422 %typemap(throws,noblock=1) SWIGTYPE { |
| 423 %raise(SWIG_NewPointerObj(%new_copy($1, $ltype),$&descriptor,SWIG_POINTER_OWN)
, "$type", $&descriptor); |
| 424 } |
| 425 |
| 426 %typemap(throws,noblock=1) SWIGTYPE * { |
| 427 %raise(SWIG_NewPointerObj(%as_voidptr($1),$descriptor,0), "$type", $descriptor
); |
| 428 } |
| 429 |
| 430 %typemap(throws,noblock=1) SWIGTYPE [ANY] { |
| 431 %raise(SWIG_NewPointerObj(%as_voidptr($1),$descriptor,0), "$type", $descriptor
); |
| 432 } |
| 433 |
| 434 %typemap(throws,noblock=1) SWIGTYPE & { |
| 435 %raise(SWIG_NewPointerObj(%as_voidptr(&$1),$descriptor,0), "$type", $descripto
r); |
| 436 } |
| 437 |
| 438 %typemap(throws,noblock=1) (...) { |
| 439 SWIG_exception_fail(SWIG_RuntimeError,"unknown exception"); |
| 440 } |
| 441 |
| 442 /* ------------------------------------------------------------ |
| 443 * --- CLASS::* typemaps --- |
| 444 * ------------------------------------------------------------ */ |
| 445 |
| 446 %typemap(in) SWIGTYPE (CLASS::*) { |
| 447 int res = SWIG_ConvertMember($input, %as_voidptr(&$1), sizeof($type),$descript
or); |
| 448 if (!SWIG_IsOK(res)) { |
| 449 %argument_fail(res,"$type",$symname, $argnum); |
| 450 } |
| 451 } |
| 452 |
| 453 %typemap(out,noblock=1) SWIGTYPE (CLASS::*) { |
| 454 %set_output(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($type), $descriptor)); |
| 455 } |
| 456 |
| 457 %typemap(varin) SWIGTYPE (CLASS::*) { |
| 458 int res = SWIG_ConvertMember($input,%as_voidptr(&$1), sizeof($type), $descript
or); |
| 459 if (!SWIG_IsOK(res)) { |
| 460 %variable_fail(res, "$type", "$name"); |
| 461 } |
| 462 } |
| 463 |
| 464 %typemap(varout,noblock=1) SWIGTYPE (CLASS::*) { |
| 465 %set_varoutput(SWIG_NewMemberObj(%as_voidptr(&$1), sizeof($type), $descriptor)
); |
| 466 } |
| 467 |
| 468 %typemap(constcode,noblock=1) SWIGTYPE (CLASS::*) { |
| 469 %set_constant("$symname", SWIG_NewMemberObj(%as_voidptr(&$value), sizeof($type
), $descriptor)); |
| 470 } |
| 471 |
| 472 #if defined(SWIG_DIRECTOR_TYPEMAPS) |
| 473 |
| 474 /* directorin */ |
| 475 |
| 476 %typemap(directorin,noblock=1) SWIGTYPE (CLASS::*) { |
| 477 $input = SWIG_NewMemberObj(%as_voidptr(&$1_name), sizeof($type), $descriptor); |
| 478 } |
| 479 |
| 480 /* directorout */ |
| 481 |
| 482 %typemap(directorout) SWIGTYPE (CLASS::*) { |
| 483 int swig_res = SWIG_ConvertMember($input,%as_voidptr(&$result), sizeof($type),
$descriptor); |
| 484 if (!SWIG_IsOK(swig_res)) { |
| 485 %dirout_fail(swig_res,"$type"); |
| 486 } |
| 487 } |
| 488 #endif |
| 489 |
| 490 /* ------------------------------------------------------------ |
| 491 * --- function ptr typemaps --- |
| 492 * ------------------------------------------------------------ */ |
| 493 |
| 494 /* |
| 495 ISO C++ doesn't allow direct casting of a function ptr to a object |
| 496 ptr. So, maybe the ptr sizes are not the same, and we need to take |
| 497 some providences. |
| 498 */ |
| 499 %typemap(in) SWIGTYPE ((*)(ANY)) { |
| 500 int res = SWIG_ConvertFunctionPtr($input, (void**)(&$1), $descriptor); |
| 501 if (!SWIG_IsOK(res)) { |
| 502 %argument_fail(res,"$type",$symname, $argnum); |
| 503 } |
| 504 } |
| 505 |
| 506 %typecheck(SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE ((*)(ANY)) { |
| 507 void *ptr = 0; |
| 508 int res = SWIG_ConvertFunctionPtr($input, &ptr, $descriptor); |
| 509 $1 = SWIG_CheckState(res); |
| 510 } |
| 511 |
| 512 |
| 513 %typemap(out, noblock=1) SWIGTYPE ((*)(ANY)) { |
| 514 %set_output(SWIG_NewFunctionPtrObj((void *)($1), $descriptor)); |
| 515 } |
| 516 |
| 517 %typemap(varin) SWIGTYPE ((*)(ANY)) { |
| 518 int res = SWIG_ConvertFunctionPtr($input, (void**)(&$1), $descriptor); |
| 519 if (!SWIG_IsOK(res)) { |
| 520 %variable_fail(res, "$type", "$name"); |
| 521 } |
| 522 } |
| 523 |
| 524 %typemap(varout,noblock=1) SWIGTYPE ((*)(ANY)) { |
| 525 %set_varoutput(SWIG_NewFunctionPtrObj((void *)($1), $descriptor)); |
| 526 } |
| 527 |
| 528 %typemap(constcode, noblock=1) SWIGTYPE ((*)(ANY)){ |
| 529 %set_constant("$symname", SWIG_NewFunctionPtrObj((void *)$value, $descriptor))
; |
| 530 } |
| 531 |
| 532 #if defined(SWIG_DIRECTOR_TYPEMAPS) |
| 533 |
| 534 /* directorin */ |
| 535 |
| 536 %typemap(directorin,noblock=1) SWIGTYPE ((*)(ANY)) { |
| 537 $input = SWIG_NewFunctionPtrObj((void*)($1_name), $descriptor); |
| 538 } |
| 539 |
| 540 /* directorout */ |
| 541 |
| 542 %typemap(directorout) SWIGTYPE ((*)(ANY)) { |
| 543 int swig_res = SWIG_ConvertFunctionPtr($input,(void**)(&$result),$descriptor); |
| 544 if (!SWIG_IsOK(swig_res)) { |
| 545 %dirout_fail(swig_res,"$type"); |
| 546 } |
| 547 } |
| 548 #endif |
| 549 |
| 550 |
| 551 /* ------------------------------------------------------------ |
| 552 * --- Special typemaps --- |
| 553 * ------------------------------------------------------------ */ |
| 554 |
| 555 /* VARARGS_SENTINEL typemap. Used by the %varargs directive. */ |
| 556 |
| 557 %typemap(in,numinputs=0) SWIGTYPE *VARARGS_SENTINEL, SWIGTYPE VARARGS_SENTINEL "
"; |
| 558 |
| 559 |
| 560 /* DISOWN typemap */ |
| 561 |
| 562 %typemap(in, noblock=1) SWIGTYPE *DISOWN (int res = 0) { |
| 563 res = SWIG_ConvertPtr($input, %as_voidptrptr(&$1), $descriptor, SWIG_POINTER_D
ISOWN | %convertptr_flags); |
| 564 if (!SWIG_IsOK(res)) { |
| 565 %argument_fail(res,"$type", $symname, $argnum); |
| 566 } |
| 567 } |
| 568 |
| 569 %typemap(varin) SWIGTYPE *DISOWN { |
| 570 void *temp = 0; |
| 571 int res = SWIG_ConvertPtr($input, &temp, $descriptor, SWIG_POINTER_DISOWN | %c
onvertptr_flags); |
| 572 if (!SWIG_IsOK(res)) { |
| 573 %variable_fail(res, "$type", "$name"); |
| 574 } |
| 575 $1 = ($ltype) temp; |
| 576 } |
| 577 |
| 578 /* DYNAMIC typemap */ |
| 579 |
| 580 %typemap(out,noblock=1) SWIGTYPE *DYNAMIC, SWIGTYPE &DYNAMIC { |
| 581 %set_output(SWIG_NewPointerObj(%as_voidptr($1), SWIG_TypeDynamicCast($descript
or, %as_voidptrptr(&$1)), $owner | %newpointer_flags)); |
| 582 } |
| 583 |
| 584 /* INSTANCE typemap */ |
| 585 |
| 586 %typemap(out,noblock=1) SWIGTYPE INSTANCE { |
| 587 %set_output(SWIG_NewInstanceObj(%new_copy($1, $1_ltype), $&1_descriptor, SWIG_
POINTER_OWN | %newinstance_flags)); |
| 588 } |
| 589 |
| 590 %typemap(out,noblock=1) SWIGTYPE *INSTANCE, SWIGTYPE &INSTANCE, SWIGTYPE INSTANC
E[] { |
| 591 %set_output(SWIG_NewInstanceObj(%as_voidptr($1), $1_descriptor, $owner | %newi
nstance_flags)); |
| 592 } |
| 593 |
| 594 %typemap(varout,noblock=1) SWIGTYPE *INSTANCE, SWIGTYPE INSTANCE[] { |
| 595 %set_varoutput(SWIG_NewInstanceObj(%as_voidptr($1), $1_descriptor, %newinstanc
e_flags)); |
| 596 } |
| 597 |
| 598 %typemap(varout,noblock=1) SWIGTYPE &INSTANCE { |
| 599 %set_varoutput(SWIG_NewInstanceObj(%as_voidptr($1), $1_descriptor, %newinstanc
e_flags)); |
| 600 } |
| 601 |
| 602 %typemap(varout,noblock=1) SWIGTYPE INSTANCE { |
| 603 %set_varoutput(SWIG_NewInstanceObj(%as_voidptr(&$1), $&1_descriptor, %newinsta
nce_flags)); |
| 604 } |
OLD | NEW |