def map_type(cffi_type):
 kind = getattr(cffi_type, 'kind', '')
 if (kind == 'union'):
  raise TypeError('No support for CFFI union')
 elif (kind == 'function'):
  if cffi_type.ellipsis:
   raise TypeError('vararg function is not supported')
  restype = map_type(cffi_type.result)
  argtypes = [map_type(arg) for arg in cffi_type.args]
  return templates.signature(restype, *argtypes)
 elif (kind == 'pointer'):
  pointee = cffi_type.item
  if (pointee.kind == 'void'):
   return types.voidptr
  else:
   return types.CPointer(map_type(pointee))
 else:
  result = _type_map().get(cffi_type)
  if (result is None):
   raise TypeError(cffi_type)
  return result

def map_type ( cffi_type ) : kind = getattr ( cffi_type , 'kind' , '' ) if ( kind == 'union' ) : raise TypeError ( 'No support for CFFI union' ) elif ( kind == 'function' ) : if cffi_type . ellipsis : raise TypeError ( 'vararg function is not supported' ) restype = map_type ( cffi_type . result ) argtypes = [ map_type ( arg ) for arg in cffi_type . args ] return templates . signature ( restype , * argtypes ) elif ( kind == 'pointer' ) : pointee = cffi_type . item if ( pointee . kind == 'void' ) : return types . voidptr else : return types . CPointer ( map_type ( pointee ) ) else : result = _type_map ( ) . get ( cffi_type ) if ( result is None ) : raise TypeError ( cffi_type ) return result
map cffi type to numba type .