PageRenderTime 37ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/Lib/typemaps/void.swg

#
Unknown | 84 lines | 64 code | 20 blank | 0 comment | 0 complexity | 6e39f2ddb735d3d699d218f5daa9735a MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. /* ------------------------------------------------------------
  2. * Void * - Accepts any kind of pointer
  3. * ------------------------------------------------------------ */
  4. /* in */
  5. %typemap(in,noblock=1) void * (int res) {
  6. res = SWIG_ConvertPtr($input,%as_voidptrptr(&$1), 0, $disown);
  7. if (!SWIG_IsOK(res)) {
  8. %argument_fail(res, "$type", $symname, $argnum);
  9. }
  10. }
  11. %typemap(freearg) void * "";
  12. %typemap(in,noblock=1) void * const& ($*ltype temp = 0, int res) {
  13. res = SWIG_ConvertPtr($input, %as_voidptrptr(&temp), 0, $disown);
  14. if (!SWIG_IsOK(res)) {
  15. %argument_fail(res, "Stype", $symname, $argnum);
  16. }
  17. $1 = &temp;
  18. }
  19. %typemap(freearg) void * const& "";
  20. /* out */
  21. #if defined(VOID_Object)
  22. %typemap(out,noblock=1) void { $result = VOID_Object; }
  23. #else
  24. %typemap(out,noblock=1) void {}
  25. #endif
  26. /* varin */
  27. %typemap(varin) void * {
  28. void *temp = 0;
  29. int res = SWIG_ConvertPtr($input, &temp, 0, SWIG_POINTER_DISOWN);
  30. if (!SWIG_IsOK(res)) {
  31. %variable_fail(res, "$type", "$name");
  32. }
  33. $1 = ($1_ltype) temp;
  34. }
  35. /* typecheck */
  36. %typecheck(SWIG_TYPECHECK_VOIDPTR, noblock=1) void *
  37. {
  38. void *ptr = 0;
  39. int res = SWIG_ConvertPtr($input, &ptr, 0, 0);
  40. $1 = SWIG_CheckState(res);
  41. }
  42. #if defined(SWIG_DIRECTOR_TYPEMAPS)
  43. /* directorin */
  44. %typemap(directorin,noblock=1) void *, void const*, void *const, void const *const,
  45. void const *&, void *const &, void const *const & {
  46. $input = SWIG_NewPointerObj(%as_voidptr($1), $descriptor, %newpointer_flags);
  47. }
  48. /* directorout */
  49. %typemap(directorout,noblock=1) void * (void *argp, int res) {
  50. res = SWIG_ConvertPtr($input, &argp, 0, 0);
  51. if (!SWIG_IsOK(res)) {
  52. %dirout_fail(res,"$type");
  53. }
  54. $result = %reinterpret_cast(argp, $ltype);
  55. }
  56. %typemap(directorout,noblock=1,warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) void * const& (void *argp, int res) {
  57. res = SWIG_ConvertPtr($input, &argp, 0, $disown);
  58. if (!SWIG_IsOK(res)) {
  59. %dirout_fail(res,"$type");
  60. }
  61. static $*ltype temp = %reinterpret_cast(argp, $*ltype);
  62. $result = &temp;
  63. }
  64. #endif /* SWIG_DIRECTOR_TYPEMAPS */