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
|
/*
* copyright_notice
*/
%typemap(in)
const GLbitfield*,
const GLboolean*,
const GLbyte*,
const GLclampd*,
const GLclampf*,
const GLdouble*,
const GLdouble[ANY],
const GLenum*,
const GLfloat*,
const GLint*,
const GLint[ANY],
const GLshort*,
const GLsizei*,
const GLubyte*,
const GLuint*,
const GLushort*,
const GLvoid*
{
if ( $input == Py_None )
{
//printf("input is None\n") ;
$1 = NULL ;
}
else if ( PySequence_Check($input) )
{
//printf("input is a sequence\n") ;
Py_ssize_t buffer_len ;
if ( PyObject_AsReadBuffer( $input ,
( const void * * ) & $1 ,
& buffer_len ) != 0 )
{
printf("glextlib: input is actually null\n") ;
$1 = NULL ;
}
}
else
{
//printf("input is not a sequence\n") ;
$1 = (GLvoid *) PyInt_AsLong( $input ) ;
}
}
%typemap(in)
GLbitfield*,
GLboolean*,
GLbyte*,
GLclampd*,
GLclampf*,
GLdouble*,
GLenum*,
GLfloat*,
GLint*, int*, /*glX*/
GLshort*,
GLsizei*,
GLubyte*,
GLuint*,
GLushort*,
GLvoid*,
GLint[ANY]
{
Py_ssize_t buffer_len;
if (PyObject_AsWriteBuffer( $input, (void**)&$1, &buffer_len))
return NULL;
if (! $1) return PyErr_Format( PyExc_ValueError,
"NULL buffer not accepted");
}
%typemap(argout)
Glvoid**
{
$result = PyCObject_FromVoidPtr( *$1, NULL);
}
%typemap(out)
char*,
const char*,
char const*,
unsigned char*,
const unsigned char*,
unsigned char const*
{
if ($1) $result = PyString_FromString( (char const*)$1);
else
{
Py_INCREF( Py_None);
$result = Py_None;
}
}
%include "glArrayTypemap.i"
|