"""Array data-type implementations (abstraction points for GL array types"""
import ctypes
import OpenGL
from OpenGL.raw.GL import _types
from OpenGL import plugins
from OpenGL.arrays import formathandler, _arrayconstants as GL_1_1
from OpenGL import logs
_log = logs.getLog( 'OpenGL.arrays.arraydatatype' )


from OpenGL import acceleratesupport
ADT = None
if acceleratesupport.ACCELERATE_AVAILABLE:
    try:
        from OpenGL_accelerate.arraydatatype import ArrayDatatype as ADT
    except ImportError as err:
        _log.warn(
            "Unable to load ArrayDatatype accelerator from OpenGL_accelerate"
        )
if ADT is None:
    # Python-coded version
    class HandlerRegistry( dict ):
        GENERIC_OUTPUT_PREFERENCES = ['numpy','ctypesarrays']
        def __init__( self, plugin_match ):
            self.match = plugin_match
            self.output_handler = None 
            self.preferredOutput = None
            self.all_output_handlers = []
        def __call__( self, value ):
            """Lookup of handler for given value"""
            try:
                typ = value.__class__
            except AttributeError as err:
                typ = type(value)
            handler = self.get( typ )
            if not handler:
                if hasattr( typ, '__mro__' ):
                    for base in typ.__mro__:
                        handler = self.get( base )
                        if not handler:
                            handler = self.match( base )
                            if handler:
                                handler = handler.load()
                                if handler:
                                    handler = handler()
                        if handler:
                            self[ typ ] = handler
                            if hasattr( handler, 'registerEquivalent' ):
                                handler.registerEquivalent( typ, base )
                            return handler
                raise TypeError(
                    """No array-type handler for type %s.%s (value: %s) registered"""%(
                        typ.__module__, type.__name__, repr(value)[:50]
                    )
                )
            return handler
        
        def handler_by_plugin_name( self, name ):
            plugin = plugins.FormatHandler.by_name( name )
            if plugin:
                try:
                    return plugin.load()
                except ImportError as err:
                    return None
            else:
                raise RuntimeError( 'No handler of name %s found'%(name,))
        
        def get_output_handler( self ):
            """Fast-path lookup for output handler object"""
            if self.output_handler is None:
                if self.preferredOutput is not None:
                    self.output_handler = self.handler_by_plugin_name( self.preferredOutput )
                if not self.output_handler:
                    for preferred in self.GENERIC_OUTPUT_PREFERENCES:
                        self.output_handler = self.handler_by_plugin_name( preferred )
                        if self.output_handler:
                            break
                if not self.output_handler:
                    raise RuntimeError(
                        """Unable to find any output handler at all (not even ctypes/numpy ones!)"""
                    )
            return self.output_handler
        
        def register( self, handler, types=None ):
            """Register this class as handler for given set of types"""
            if not isinstance( types, (list,tuple)):
                types = [ types ]
            for type in types:
                self[ type ] = handler
            if handler.isOutput:
                self.all_output_handlers.append( handler )
            
        def registerReturn( self, handler ):
            """Register this handler as the default return-type handler"""
            if isinstance( handler, (str,unicode)):
                self.preferredOutput = handler 
                self.output_handler = None
            else:
                self.preferredOutput = None 
                self.output_handler = handler 
    
    GLOBAL_REGISTRY = HandlerRegistry( plugins.FormatHandler.match)
    formathandler.FormatHandler.TYPE_REGISTRY = GLOBAL_REGISTRY
    
    class ArrayDatatype( object ):
        """Mix-in for array datatype classes
        
        The ArrayDatatype marker essentially is used to mark a particular argument
        as having an "array" type, which means that it is eligible for handling 
        via the arrays sub-package and its registered handlers.
        """
        typeConstant = None
        handler = GLOBAL_REGISTRY
        getHandler = GLOBAL_REGISTRY.__call__
        returnHandler = GLOBAL_REGISTRY.get_output_handler
        isAccelerated = False
        @classmethod
        def getRegistry( cls ):
            """Get our handler registry"""
            return cls.handler 
        def from_param( cls, value, typeConstant=None ):
            """Given a value in a known data-pointer type, convert to a ctypes pointer"""
            return cls.getHandler(value).from_param( value, cls.typeConstant )
        from_param = classmethod( logs.logOnFail( from_param, _log ) )
        def dataPointer( cls, value ):
            """Given a value in a known data-pointer type, return long for pointer"""
            try:
                return cls.getHandler(value).dataPointer( value )
            except Exception as err:
                _log.warn(
                    """Failure in dataPointer for %s instance %s""", type(value), value,
                )
                raise
        dataPointer = classmethod( logs.logOnFail( dataPointer, _log ) )
        def voidDataPointer( cls, value ):
            """Given value in a known data-pointer type, return void_p for pointer"""
            pointer = cls.dataPointer( value )
            try:
                return ctypes.c_void_p(pointer)
            except TypeError as err:
                return pointer
        voidDataPointer = classmethod( logs.logOnFail( voidDataPointer, _log ) )
        def typedPointer( cls, value ):
            """Return a pointer-to-base-type pointer for given value"""
            return ctypes.cast( cls.dataPointer(value), ctypes.POINTER( cls.baseType ))
        typedPointer = classmethod( typedPointer )
        def asArray( cls, value, typeCode=None ):
            """Given a value, convert to preferred array representation"""
            return cls.getHandler(value).asArray( value, typeCode or cls.typeConstant )
        asArray = classmethod( logs.logOnFail( asArray, _log ) )
        def arrayToGLType( cls, value ):
            """Given a data-value, guess the OpenGL type of the corresponding pointer
            
            Note: this is not currently used in PyOpenGL and may be removed 
            eventually.
            """
            return cls.getHandler(value).arrayToGLType( value )
        arrayToGLType = classmethod( logs.logOnFail( arrayToGLType, _log ) )
        def arraySize( cls, value, typeCode = None ):
            """Given a data-value, calculate dimensions for the array (number-of-units)"""
            return cls.getHandler(value).arraySize( value, typeCode or cls.typeConstant )
        arraySize = classmethod( logs.logOnFail( arraySize, _log ) )
        def unitSize( cls, value, typeCode=None ):
            """Determine unit size of an array (if possible)
            
            Uses our local type if defined, otherwise asks the handler to guess...
            """
            return cls.getHandler(value).unitSize( value, typeCode or cls.typeConstant )
        unitSize = classmethod( logs.logOnFail( unitSize, _log ) )
        def zeros( cls, dims, typeCode=None ):
            """Allocate a return array of the given dimensions filled with zeros"""
            return cls.returnHandler().zeros( dims, typeCode or cls.typeConstant )
        zeros = classmethod( logs.logOnFail( zeros, _log ) )
        def dimensions( cls, value ):
            """Given a data-value, get the dimensions (assumes full structure info)"""
            return cls.getHandler(value).dimensions( value )
        dimensions = classmethod( logs.logOnFail( dimensions, _log ) )
        
        def arrayByteCount( cls, value ):
            """Given a data-value, try to determine number of bytes it's final form occupies
            
            For most data-types this is arraySize() * atomic-unit-size
            """
            return cls.getHandler(value).arrayByteCount( value )
        arrayByteCount = classmethod( logs.logOnFail( arrayByteCount, _log ) )
            

    # the final array data-type classes...
    class GLclampdArray( ArrayDatatype, ctypes.POINTER(_types.GLclampd )):
        """Array datatype for GLclampd types"""
        baseType = _types.GLclampd
        typeConstant = _types.GL_DOUBLE

    class GLclampfArray( ArrayDatatype, ctypes.POINTER(_types.GLclampf )):
        """Array datatype for GLclampf types"""
        baseType = _types.GLclampf
        typeConstant = _types.GL_FLOAT

    class GLfloatArray( ArrayDatatype, ctypes.POINTER(_types.GLfloat )):
        """Array datatype for GLfloat types"""
        baseType = _types.GLfloat
        typeConstant = _types.GL_FLOAT

    class GLdoubleArray( ArrayDatatype, ctypes.POINTER(_types.GLdouble )):
        """Array datatype for GLdouble types"""
        baseType = _types.GLdouble
        typeConstant = _types.GL_DOUBLE

    class GLbyteArray( ArrayDatatype, ctypes.POINTER(_types.GLbyte )):
        """Array datatype for GLbyte types"""
        baseType = _types.GLbyte
        typeConstant = _types.GL_BYTE

    class GLcharArray( ArrayDatatype, ctypes.c_char_p):
        """Array datatype for ARB extension pointers-to-arrays"""
        baseType = _types.GLchar
        typeConstant = _types.GL_BYTE
    GLcharARBArray = GLcharArray

    class GLshortArray( ArrayDatatype, ctypes.POINTER(_types.GLshort )):
        """Array datatype for GLshort types"""
        baseType = _types.GLshort
        typeConstant = _types.GL_SHORT

    class GLintArray( ArrayDatatype, ctypes.POINTER(_types.GLint )):
        """Array datatype for GLint types"""
        baseType = _types.GLint
        typeConstant = _types.GL_INT

    class GLubyteArray( ArrayDatatype, ctypes.POINTER(_types.GLubyte )):
        """Array datatype for GLubyte types"""
        baseType = _types.GLubyte
        typeConstant = _types.GL_UNSIGNED_BYTE
    GLbooleanArray = GLubyteArray

    class GLushortArray( ArrayDatatype, ctypes.POINTER(_types.GLushort )):
        """Array datatype for GLushort types"""
        baseType = _types.GLushort
        typeConstant = _types.GL_UNSIGNED_SHORT

    class GLuintArray( ArrayDatatype, ctypes.POINTER(_types.GLuint )):
        """Array datatype for GLuint types"""
        baseType = _types.GLuint
        typeConstant = _types.GL_UNSIGNED_INT
    
    class GLint64Array( ArrayDatatype, ctypes.POINTER(_types.GLint64 )):
        """Array datatype for GLuint types"""
        baseType = _types.GLint64
        typeConstant = None # TODO: find out what this should be!
    
    class GLuint64Array( ArrayDatatype, ctypes.POINTER(_types.GLuint64 )):
        """Array datatype for GLuint types"""
        baseType = _types.GLuint64
        typeConstant = _types.GL_UNSIGNED_INT64

    class GLenumArray( ArrayDatatype, ctypes.POINTER(_types.GLenum )):
        """Array datatype for GLenum types"""
        baseType = _types.GLenum
        typeConstant = _types.GL_UNSIGNED_INT
    class GLsizeiArray( ArrayDatatype, ctypes.POINTER(_types.GLsizei )):
        """Array datatype for GLsizei types"""
        baseType = _types.GLsizei
        typeConstant = _types.GL_INT
    class GLvoidpArray( ArrayDatatype, ctypes.POINTER(_types.GLvoid )):
        """Array datatype for GLenum types"""
        baseType = _types.GLvoidp
        typeConstant = _types.GL_VOID_P
else:
    # Cython-coded array handler
    _log.info( 'Using accelerated ArrayDatatype' )
    ArrayDatatype = ADT( None, None )
    GLclampdArray = ADT( GL_1_1.GL_DOUBLE, _types.GLclampd )
    GLclampfArray = ADT( GL_1_1.GL_FLOAT, _types.GLclampf )
    GLdoubleArray = ADT( GL_1_1.GL_DOUBLE, _types.GLdouble )
    GLfloatArray = ADT( GL_1_1.GL_FLOAT, _types.GLfloat )
    GLbyteArray = ADT( GL_1_1.GL_BYTE, _types.GLbyte )
    GLcharArray = GLcharARBArray = ADT( GL_1_1.GL_BYTE, _types.GLchar )
    GLshortArray = ADT( GL_1_1.GL_SHORT, _types.GLshort )
    GLintArray = ADT( GL_1_1.GL_INT, _types.GLint )
    GLubyteArray = GLbooleanArray = ADT( GL_1_1.GL_UNSIGNED_BYTE, _types.GLubyte )
    GLushortArray = ADT( GL_1_1.GL_UNSIGNED_SHORT, _types.GLushort )
    GLuintArray = ADT( GL_1_1.GL_UNSIGNED_INT, _types.GLuint )
    GLint64Array = ADT( None, _types.GLint64 )
    GLuint64Array = ADT( GL_1_1.GL_UNSIGNED_INT64, _types.GLuint64 )
    GLenumArray = ADT( GL_1_1.GL_UNSIGNED_INT, _types.GLenum )
    GLsizeiArray = ADT( GL_1_1.GL_INT, _types.GLsizei )
    GLvoidpArray = ADT( _types.GL_VOID_P, _types.GLvoidp )

GL_CONSTANT_TO_ARRAY_TYPE = {
    GL_1_1.GL_DOUBLE : GLclampdArray,
    GL_1_1.GL_FLOAT : GLclampfArray,
    GL_1_1.GL_FLOAT : GLfloatArray,
    GL_1_1.GL_DOUBLE : GLdoubleArray,
    GL_1_1.GL_BYTE : GLbyteArray,
    GL_1_1.GL_SHORT : GLshortArray,
    GL_1_1.GL_INT : GLintArray,
    GL_1_1.GL_UNSIGNED_BYTE : GLubyteArray,
    GL_1_1.GL_UNSIGNED_SHORT : GLushortArray,
    GL_1_1.GL_UNSIGNED_INT : GLuintArray,
    #GL_1_1.GL_UNSIGNED_INT : GLenumArray,
}

[((8, 7, 8, 51), 'OpenGL.logs.getLog', 'logs.getLog', ({(8, 20, 8, 49): '"""OpenGL.arrays.arraydatatype"""'}, {}), "('OpenGL.arrays.arraydatatype')", False, 'from OpenGL import logs\n'), ((189, 40, 189, 72), 'ctypes.POINTER', 'ctypes.POINTER', ({(189, 55, 189, 70): '_types.GLclampd'}, {}), '(_types.GLclampd)', False, 'import ctypes\n'), ((194, 40, 194, 72), 'ctypes.POINTER', 'ctypes.POINTER', ({(194, 55, 194, 70): '_types.GLclampf'}, {}), '(_types.GLclampf)', False, 'import ctypes\n'), ((199, 39, 199, 70), 'ctypes.POINTER', 'ctypes.POINTER', ({(199, 54, 199, 68): '_types.GLfloat'}, {}), '(_types.GLfloat)', False, 'import ctypes\n'), ((204, 40, 204, 72), 'ctypes.POINTER', 'ctypes.POINTER', ({(204, 55, 204, 70): '_types.GLdouble'}, {}), '(_types.GLdouble)', False, 'import ctypes\n'), ((209, 38, 209, 68), 'ctypes.POINTER', 'ctypes.POINTER', ({(209, 53, 209, 66): '_types.GLbyte'}, {}), '(_types.GLbyte)', False, 'import ctypes\n'), ((220, 39, 220, 70), 'ctypes.POINTER', 'ctypes.POINTER', ({(220, 54, 220, 68): '_types.GLshort'}, {}), '(_types.GLshort)', False, 'import ctypes\n'), ((225, 37, 225, 66), 'ctypes.POINTER', 'ctypes.POINTER', ({(225, 52, 225, 64): '_types.GLint'}, {}), '(_types.GLint)', False, 'import ctypes\n'), ((230, 39, 230, 70), 'ctypes.POINTER', 'ctypes.POINTER', ({(230, 54, 230, 68): '_types.GLubyte'}, {}), '(_types.GLubyte)', False, 'import ctypes\n'), ((236, 40, 236, 72), 'ctypes.POINTER', 'ctypes.POINTER', ({(236, 55, 236, 70): '_types.GLushort'}, {}), '(_types.GLushort)', False, 'import ctypes\n'), ((241, 38, 241, 68), 'ctypes.POINTER', 'ctypes.POINTER', ({(241, 53, 241, 66): '_types.GLuint'}, {}), '(_types.GLuint)', False, 'import ctypes\n'), ((246, 39, 246, 70), 'ctypes.POINTER', 'ctypes.POINTER', ({(246, 54, 246, 68): '_types.GLint64'}, {}), '(_types.GLint64)', False, 'import ctypes\n'), ((251, 40, 251, 72), 'ctypes.POINTER', 'ctypes.POINTER', ({(251, 55, 251, 70): '_types.GLuint64'}, {}), '(_types.GLuint64)', False, 'import ctypes\n'), ((256, 38, 256, 68), 'ctypes.POINTER', 'ctypes.POINTER', ({(256, 53, 256, 66): '_types.GLenum'}, {}), '(_types.GLenum)', False, 'import ctypes\n'), ((260, 39, 260, 70), 'ctypes.POINTER', 'ctypes.POINTER', ({(260, 54, 260, 68): '_types.GLsizei'}, {}), '(_types.GLsizei)', False, 'import ctypes\n'), ((264, 39, 264, 69), 'ctypes.POINTER', 'ctypes.POINTER', ({(264, 54, 264, 67): '_types.GLvoid'}, {}), '(_types.GLvoid)', False, 'import ctypes\n'), ((271, 20, 271, 37), 'OpenGL_accelerate.arraydatatype.ArrayDatatype', 'ADT', ({(271, 25, 271, 29): 'None', (271, 31, 271, 35): 'None'}, {}), '(None, None)', True, 'from OpenGL_accelerate.arraydatatype import ArrayDatatype as ADT\n'), ((272, 20, 272, 60), 'OpenGL_accelerate.arraydatatype.ArrayDatatype', 'ADT', ({(272, 25, 272, 41): 'GL_1_1.GL_DOUBLE', (272, 43, 272, 58): '_types.GLclampd'}, {}), '(GL_1_1.GL_DOUBLE, _types.GLclampd)', True, 'from OpenGL_accelerate.arraydatatype import ArrayDatatype as ADT\n'), ((273, 20, 273, 59), 'OpenGL_accelerate.arraydatatype.ArrayDatatype', 'ADT', ({(273, 25, 273, 40): 'GL_1_1.GL_FLOAT', (273, 42, 273, 57): '_types.GLclampf'}, {}), '(GL_1_1.GL_FLOAT, _types.GLclampf)', True, 'from OpenGL_accelerate.arraydatatype import ArrayDatatype as ADT\n'), ((274, 20, 274, 60), 'OpenGL_accelerate.arraydatatype.ArrayDatatype', 'ADT', ({(274, 25, 274, 41): 'GL_1_1.GL_DOUBLE', (274, 43, 274, 58): '_types.GLdouble'}, {}), '(GL_1_1.GL_DOUBLE, _types.GLdouble)', True, 'from OpenGL_accelerate.arraydatatype import ArrayDatatype as ADT\n'), ((275, 19, 275, 57), 'OpenGL_accelerate.arraydatatype.ArrayDatatype', 'ADT', ({(275, 24, 275, 39): 'GL_1_1.GL_FLOAT', (275, 41, 275, 55): '_types.GLfloat'}, {}), '(GL_1_1.GL_FLOAT, _types.GLfloat)', True, 'from OpenGL_accelerate.arraydatatype import ArrayDatatype as ADT\n'), ((276, 18, 276, 54), 'OpenGL_accelerate.arraydatatype.ArrayDatatype', 'ADT', ({(276, 23, 276, 37): 'GL_1_1.GL_BYTE', (276, 39, 276, 52): '_types.GLbyte'}, {}), '(GL_1_1.GL_BYTE, _types.GLbyte)', True, 'from OpenGL_accelerate.arraydatatype import ArrayDatatype as ADT\n'), ((277, 35, 277, 71), 'OpenGL_accelerate.arraydatatype.ArrayDatatype', 'ADT', ({(277, 40, 277, 54): 'GL_1_1.GL_BYTE', (277, 56, 277, 69): '_types.GLchar'}, {}), '(GL_1_1.GL_BYTE, _types.GLchar)', True, 'from OpenGL_accelerate.arraydatatype import ArrayDatatype as ADT\n'), ((278, 19, 278, 57), 'OpenGL_accelerate.arraydatatype.ArrayDatatype', 'ADT', ({(278, 24, 278, 39): 'GL_1_1.GL_SHORT', (278, 41, 278, 55): '_types.GLshort'}, {}), '(GL_1_1.GL_SHORT, _types.GLshort)', True, 'from OpenGL_accelerate.arraydatatype import ArrayDatatype as ADT\n'), ((279, 17, 279, 51), 'OpenGL_accelerate.arraydatatype.ArrayDatatype', 'ADT', ({(279, 22, 279, 35): 'GL_1_1.GL_INT', (279, 37, 279, 49): '_types.GLint'}, {}), '(GL_1_1.GL_INT, _types.GLint)', True, 'from OpenGL_accelerate.arraydatatype import ArrayDatatype as ADT\n'), ((280, 36, 280, 82), 'OpenGL_accelerate.arraydatatype.ArrayDatatype', 'ADT', ({(280, 41, 280, 64): 'GL_1_1.GL_UNSIGNED_BYTE', (280, 66, 280, 80): '_types.GLubyte'}, {}), '(GL_1_1.GL_UNSIGNED_BYTE, _types.GLubyte)', True, 'from OpenGL_accelerate.arraydatatype import ArrayDatatype as ADT\n'), ((281, 20, 281, 68), 'OpenGL_accelerate.arraydatatype.ArrayDatatype', 'ADT', ({(281, 25, 281, 49): 'GL_1_1.GL_UNSIGNED_SHORT', (281, 51, 281, 66): '_types.GLushort'}, {}), '(GL_1_1.GL_UNSIGNED_SHORT, _types.GLushort)', True, 'from OpenGL_accelerate.arraydatatype import ArrayDatatype as ADT\n'), ((282, 18, 282, 62), 'OpenGL_accelerate.arraydatatype.ArrayDatatype', 'ADT', ({(282, 23, 282, 45): 'GL_1_1.GL_UNSIGNED_INT', (282, 47, 282, 60): '_types.GLuint'}, {}), '(GL_1_1.GL_UNSIGNED_INT, _types.GLuint)', True, 'from OpenGL_accelerate.arraydatatype import ArrayDatatype as ADT\n'), ((283, 19, 283, 46), 'OpenGL_accelerate.arraydatatype.ArrayDatatype', 'ADT', ({(283, 24, 283, 28): 'None', (283, 30, 283, 44): '_types.GLint64'}, {}), '(None, _types.GLint64)', True, 'from OpenGL_accelerate.arraydatatype import ArrayDatatype as ADT\n'), ((284, 20, 284, 68), 'OpenGL_accelerate.arraydatatype.ArrayDatatype', 'ADT', ({(284, 25, 284, 49): 'GL_1_1.GL_UNSIGNED_INT64', (284, 51, 284, 66): '_types.GLuint64'}, {}), '(GL_1_1.GL_UNSIGNED_INT64, _types.GLuint64)', True, 'from OpenGL_accelerate.arraydatatype import ArrayDatatype as ADT\n'), ((285, 18, 285, 62), 'OpenGL_accelerate.arraydatatype.ArrayDatatype', 'ADT', ({(285, 23, 285, 45): 'GL_1_1.GL_UNSIGNED_INT', (285, 47, 285, 60): '_types.GLenum'}, {}), '(GL_1_1.GL_UNSIGNED_INT, _types.GLenum)', True, 'from OpenGL_accelerate.arraydatatype import ArrayDatatype as ADT\n'), ((286, 19, 286, 55), 'OpenGL_accelerate.arraydatatype.ArrayDatatype', 'ADT', ({(286, 24, 286, 37): 'GL_1_1.GL_INT', (286, 39, 286, 53): '_types.GLsizei'}, {}), '(GL_1_1.GL_INT, _types.GLsizei)', True, 'from OpenGL_accelerate.arraydatatype import ArrayDatatype as ADT\n'), ((287, 19, 287, 58), 'OpenGL_accelerate.arraydatatype.ArrayDatatype', 'ADT', ({(287, 24, 287, 40): '_types.GL_VOID_P', (287, 42, 287, 56): '_types.GLvoidp'}, {}), '(_types.GL_VOID_P, _types.GLvoidp)', True, 'from OpenGL_accelerate.arraydatatype import ArrayDatatype as ADT\n'), ((59, 21, 59, 58), 'OpenGL.plugins.FormatHandler.by_name', 'plugins.FormatHandler.by_name', ({(59, 52, 59, 56): 'name'}, {}), '(name)', False, 'from OpenGL import plugins\n'), ((124, 34, 124, 68), 'OpenGL.logs.logOnFail', 'logs.logOnFail', ({(124, 50, 124, 60): 'from_param', (124, 62, 124, 66): '_log'}, {}), '(from_param, _log)', False, 'from OpenGL import logs\n'), ((134, 35, 134, 70), 'OpenGL.logs.logOnFail', 'logs.logOnFail', ({(134, 51, 134, 62): 'dataPointer', (134, 64, 134, 68): '_log'}, {}), '(dataPointer, _log)', False, 'from OpenGL import logs\n'), ((142, 39, 142, 78), 'OpenGL.logs.logOnFail', 'logs.logOnFail', ({(142, 55, 142, 70): 'voidDataPointer', (142, 72, 142, 76): '_log'}, {}), '(voidDataPointer, _log)', False, 'from OpenGL import logs\n'), ((150, 31, 150, 62), 'OpenGL.logs.logOnFail', 'logs.logOnFail', ({(150, 47, 150, 54): 'asArray', (150, 56, 150, 60): '_log'}, {}), '(asArray, _log)', False, 'from OpenGL import logs\n'), ((158, 37, 158, 74), 'OpenGL.logs.logOnFail', 'logs.logOnFail', ({(158, 53, 158, 66): 'arrayToGLType', (158, 68, 158, 72): '_log'}, {}), '(arrayToGLType, _log)', False, 'from OpenGL import logs\n'), ((162, 33, 162, 66), 'OpenGL.logs.logOnFail', 'logs.logOnFail', ({(162, 49, 162, 58): 'arraySize', (162, 60, 162, 64): '_log'}, {}), '(arraySize, _log)', False, 'from OpenGL import logs\n'), ((169, 32, 169, 64), 'OpenGL.logs.logOnFail', 'logs.logOnFail', ({(169, 48, 169, 56): 'unitSize', (169, 58, 169, 62): '_log'}, {}), '(unitSize, _log)', False, 'from OpenGL import logs\n'), ((173, 29, 173, 58), 'OpenGL.logs.logOnFail', 'logs.logOnFail', ({(173, 45, 173, 50): 'zeros', (173, 52, 173, 56): '_log'}, {}), '(zeros, _log)', False, 'from OpenGL import logs\n'), ((177, 34, 177, 68), 'OpenGL.logs.logOnFail', 'logs.logOnFail', ({(177, 50, 177, 60): 'dimensions', (177, 62, 177, 66): '_log'}, {}), '(dimensions, _log)', False, 'from OpenGL import logs\n'), ((185, 38, 185, 76), 'OpenGL.logs.logOnFail', 'logs.logOnFail', ({(185, 54, 185, 68): 'arrayByteCount', (185, 70, 185, 74): '_log'}, {}), '(arrayByteCount, _log)', False, 'from OpenGL import logs\n'), ((139, 23, 139, 47), 'ctypes.c_void_p', 'ctypes.c_void_p', ({(139, 39, 139, 46): 'pointer'}, {}), '(pointer)', False, 'import ctypes\n'), ((145, 56, 145, 86), 'ctypes.POINTER', 'ctypes.POINTER', ({(145, 72, 145, 84): 'cls.baseType'}, {}), '(cls.baseType)', False, 'import ctypes\n')]