U
    Ã9%eå
  ã                   @   sæ   d dl mZ d dlmZ d dlmZmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZ e
ƒ ZejZe e d¡¡Zed	d
„ ƒZe ej¡e ej¡dd„ ƒƒZe ej¡dd„ ƒZe ej¡dd„ ƒZeee ej¡ƒdd„ ƒZ dS )é    )Úsingledispatch)Úir)ÚtypesÚcgutils)ÚNumbaWarning)ÚRegistry)Ú	nvvmutils)Úwarné   c                 C   s   t d| f ƒ‚dS )zµ
    Handle printing of a single value of the given Numba type.
    A (format string, [list of arguments]) is returned that will allow
    forming the final printf()-like call.
    z,printing unimplemented for values of type %sN)ÚNotImplementedError)ÚtyÚcontextÚbuilderÚval© r   úS/var/www/html/Darija-Ai-API/env/lib/python3.8/site-packages/numba/cuda/printimpl.pyÚ
print_item   s    ÿr   c                 C   s:   | t jkrd}t j}n
d}t j}| ||| |¡}||gfS )Nz%lluz%lld)r   Zunsigned_domainZuint64Zint64Úcast)r   r   r   r   ÚrawfmtZdsttypeÚlldr   r   r   Úint_print_impl   s    
r   c                 C   s   |  ||| tj¡}d|gfS )Nz%f)r   r   Zfloat64)r   r   r   r   r   r   r   r   Úreal_print_impl)   s    r   c                 C   s.   | j }t|tƒst‚d}| ||¡}||gfS )Nz%s)Zliteral_valueÚ
isinstanceÚstrÚAssertionErrorÚinsert_string_const_addrspace)r   r   r   ZsigvalZpyvalr   r   r   r   r   Úconst_print_impl/   s
    r   c                 C   sÜ   t  |j¡}g }g }tt|j|ƒƒD ]2\}\}}	t|| ||	ƒ\}
}| |
¡ | |¡ q$d 	|¡d }t
|ƒdkrŒd}t|tƒ | dd¡}|  ||¡}t ||¡}t ||¡}t  |j¡}| ||| |t¡f¡ |  ¡ S )z½This function is a generic 'print' wrapper for arbitrary types.
    It dispatches to the appropriate 'print' implementations above
    depending on the detected real types in the signature.ú Ú
é    zjCUDA print() cannot print more than 32 items. The raw format string will be emitted by the kernel instead.ú%z%%)r   Zdeclare_vprintÚmoduleÚ	enumerateÚzipÚargsr   ÚappendÚextendÚjoinÚlenr	   r   Úreplacer   r   Zmake_anonymous_structZalloca_once_valueÚcallZbitcastÚvoidptrZget_dummy_value)r   r   Úsigr$   ZvprintÚformatsÚvaluesÚiZargtypeÚargvalZargfmtZargvalsr   ÚmsgÚfmtÚarrayZarrayptrr   r   r   Úprint_varargs8   s$    

r4   N)!Ú	functoolsr   Zllvmliter   Z
numba.corer   r   Znumba.core.errorsr   Znumba.core.imputilsr   Z
numba.cudar   Úwarningsr	   ÚregistryÚlowerZPointerTypeZIntTyper+   r   ÚregisterÚIntegerZIntegerLiteralr   ÚFloatr   ZStringLiteralr   ÚprintZVarArgÚAnyr4   r   r   r   r   Ú<module>   s(   







