summaryrefslogtreecommitdiff
path: root/Lib/python/pyvoid.swg
blob: 639a74eafd945f45f2603a5ba5ebf3da6d55eeab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* ------------------------------------------------------------
 * Void * -  Accepts any kind of pointer
 * ------------------------------------------------------------ */

/* in */

%typemap(in) void * {
  if ((SWIG_ConvertPtr($input,SWIG_reinterpret_cast(&$1,void **),0,SWIG_POINTER_EXCEPTION|$disown))== -1) { 
    SWIG_arg_fail($argnum);SWIG_fail;
  }
}

%typemap(in) const void *& ($basetype temp) {
  SWIG_ConvertPtr($input,SWIG_reinterpret_cast(&temp,void **),0,SWIG_POINTER_EXCEPTION|$disown);
  if (SWIG_arg_fail($argnum)) SWIG_fail;
  $1 = &temp;
}


/* out */

%typemap(out) void "Py_INCREF(Py_None); $result = Py_None;";

/* varin */

%typemap(varin) void * {
  void * temp;
  if ((SWIG_ConvertPtr($input, SWIG_static_cast(&temp,void **), 0,
		       SWIG_POINTER_EXCEPTION | SWIG_POINTER_DISOWN)) == -1) {
    SWIG_append_errmsg("C/C++ variable '$name'");
    return 1;
  }
  $1 = ($1_ltype) temp;
}

/* varout */

%typemap(varout) void "Py_INCREF(Py_None); $result = Py_None;";

/* directorout */

%typemap(directorout) void * {
  if ((SWIG_ConvertPtr($input,(void **)(&$result),
	 	       0, SWIG_POINTER_EXCEPTION | $disown )) == -1)
    throw Swig::DirectorTypeMismatchException("Pointer conversion failed.");
}



/* typecheck */

%typecheck(SWIG_TYPECHECK_VOIDPTR) void *
{
  void *ptr;
  if (SWIG_ConvertPtr($input, &ptr, 0, 0) == -1) {
    $1 = 0;
    PyErr_Clear();
  } else {
    $1 = 1;
  }
}