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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
|
/********** Simple input values **********/
%typemap(python, in) GLbyte, GLubyte, GLshort
{
if (PyInt_Check($input) || PyLong_Check($input))
{
$1= ($1_type)(PyInt_AsLong( $input ));
}
else if (PyString_Check ($input))
{
/* what is a GLshort's size? */
$1= ($1_type) PyString_AsString($input)[0];
}
}
%typemap(python, in) GLboolean
{
$1= (PyObject_IsTrue($input)) ? GL_TRUE : GL_FALSE;
}
%typemap(python, out) const GLubyte*
{
if ($1)
{
$result= PyString_FromString($1);
}
else
{
Py_INCREF($result = Py_None);
}
}
%typemap(python, in) const void *buffer
{
int len;
PyObject* str;
if ($input == Py_None)
{
$1= NULL;
}
else
{
str = PyObject_Str($input);
PyString_AsStringAndSize(str, (char**)&$1, &len);
Py_DECREF(str);
}
}
%typemap(python, out) const wchar_t*
{
if ($1)
{
$result = PyUnicode_FromWideChar($1, wcslen($1));
}
else
{
Py_INCREF($result= Py_None);
}
}
%typemap(python,in) PyObject*, void*
{
$1 = $input;
}
%typemap(python,out) PyObject*, void*
{
$result= $1;
}
%typemap(python,in) PyObject* pyfunc
{
if ($input != Py_None && !PyCallable_Check($input))
{
PyErr_SetString(PyExc_Exception, "Not callable.");
return NULL;
}
$1 = $input;
}
%typemap(python,ignore) GLenum type_UNSIGNED_BYTE
{
$1 = GL_UNSIGNED_BYTE;
}
%typemap(python,ignore) GLenum type_BYTE
{
$1 = GL_BYTE;
}
%typemap(python,ignore) GLenum type_UNSIGNED_SHORT
{
$1 = GL_UNSIGNED_SHORT;
}
%typemap(python,ignore) GLenum type_SHORT
{
$1 = GL_SHORT;
}
%typemap(python,ignore) GLenum type_UNSIGNED_INT
{
$1 = GL_UNSIGNED_INT;
}
%typemap(python,ignore) GLenum type_INT
{
$1 = GL_INT;
}
%typemap(python,ignore) GLenum type_FLOAT
{
$1 = GL_FLOAT;
}
%typemap(python,ignore) GLenum type_DOUBLE
{
$1 = GL_DOUBLE;
}
%typemap(python,ignore) GLsizei stride_0, GLint stride_0, GLint ustride_0, GLint vstride_0
{
$1 = 0;
}
|