PageRenderTime 5ms CodeModel.GetById 2ms app.highlight 1ms RepoModel.GetById 0ms app.codeStats 1ms

/trunk/Lib/typemaps/void.swg

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