403Webshell
Server IP : 93.86.61.54  /  Your IP : 216.73.216.206
Web Server : Apache/2.4.62 (Ubuntu)
System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64
User : www-data ( 33)
PHP Version : 8.4.22
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/pythran/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/pythran/__pycache__/cxxgen.cpython-310.pyc
o

�@�axX�@s dZddlmZddlmZddlmZdZGdd�de�Z	Gdd	�d	e�Z
Gd
d�de
�ZGdd
�d
e
�ZGdd�de�Z
Gdd�de
�ZGdd�de�ZGdd�de
�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGd d!�d!e�ZGd"d#�d#e�ZGd$d%�d%e�ZGd&d'�d'e�ZGd(d)�d)e�ZGd*d+�d+e�ZGd,d-�d-e�ZGd.d/�d/e�ZGd0d1�d1e�ZGd2d3�d3e�ZGd4d5�d5e�Z Gd6d7�d7e�Z!Gd8d9�d9e�Z"Gd:d;�d;e�Z#Gd<d=�d=e#�Z$Gd>d?�d?e#�Z%Gd@dA�dAe�Z&GdBdC�dCe�Z'dDS)Ez
Generator for C/C++.
�)�dedent)�pythran_ward)�signatures_to_stringz$Copyright (C) 2008 Andreas Kloecknerc@seZdZddd�ZdS)�NopTccs�dVdS�N��)�self�with_semicolonrr�0/usr/lib/python3/dist-packages/pythran/cxxgen.py�generate's�
zNop.generateN�T��__name__�
__module__�__qualname__rrrrrr%src@s&eZdZd	dd�Zdd�Zdd�ZdS)
�
DeclaratorTccsp�|��\}}t|�}|dd�D]}|Vq|rdnd}|dur,d|d|fVdSd|d||fVdS)N����;rz%s%sz%s %s%s)�
get_decl_pair�list)r	r
�tp_lines�tp_decl�line�scrrrr,s�zDeclarator.generatecCsdS)aHReturn a tuple ``(type_lines, rhs)``.

        *type_lines* is a non-empty list of lines (most often just a
        single one) describing the type of this declarator. *rhs* is the right-
        hand side that actually contains the function/array/constness notation
        making up the bulk of the declarator syntax.
        Nr�r	rrrr7szDeclarator.get_decl_paircCs.|��\}}d�|�}|dur|Sd||fS)z'Return the declarator as a single line.� Nz%s %s)r�join)r	rrrrr�inline@s

zDeclarator.inlineNr
)rrrrrrrrrrr+s
	rc@s eZdZdZdd�Zdd�ZdS)�Valuez@A simple declarator: *typename* and *name* are given as strings.cC�||_||_dS�N��typename�name)r	r#r$rrr�__init__M�
zValue.__init__cCs|jg|jfSr!r"rrrrrQszValue.get_decl_pairN�rrr�__doc__r%rrrrrrJsrc@s(eZdZdd�Zedd��Zdd�ZdS)�NestedDeclaratorcC�
||_dSr!)�subdecl�r	r+rrrr%V�
zNestedDeclarator.__init__cCs|jjSr!)r+r$rrrrr$YszNestedDeclarator.namecCs
|j��Sr!�r+rrrrrr]r-zNestedDeclarator.get_decl_pairN)rrrr%�propertyr$rrrrrr)Us

r)c@�eZdZddd�Zdd�ZdS)�
DeclSpecifierrcCst�||�||_||_dSr!)r)r%�spec�sep)r	r+r2r3rrrr%bs
zDeclSpecifier.__init__cs&�fdd�}�j��\}}||�|fS)Nc3sN�t|�}zd�j�jt|�fVWn	tyYnw|D]}|VqdS)Nz%s%s%s)�iterr2r3�next�
StopIteration)�sub_it�itrrrr�add_spechs���z-DeclSpecifier.get_decl_pair.<locals>.add_specr.)r	r9�sub_tp�sub_declrrrrgs
zDeclSpecifier.get_decl_pairN)r�rrrr%rrrrrr1a�
r1c@�eZdZdd�ZdS)�TypedefcCst�||d�dS)N�typedef)r1r%r,rrrr%wszTypedef.__init__N�rrrr%rrrrr?v�r?c@�eZdZdd�Zdd�ZdS)�FunctionDeclarationcGs"t�||�d|_||_||_dS)NT)r)r%r�	arg_decls�
attributes)r	r+rErFrrrr%|s
zFunctionDeclaration.__init__cCsJ|j��\}}|jrdg|}|d|d�dd�|jD��d�|j�ffS)Nrz	%s(%s) %s�, css�|]}|��VqdSr!)r)�.0�adrrr�	<genexpr>���z4FunctionDeclaration.get_decl_pair.<locals>.<genexpr>r)r+rrrrErF)r	r:r;rrrr�s

�z!FunctionDeclaration.get_decl_pairNr<rrrrrD{srDc@s"eZdZdZddd�Zdd�ZdS)�Structa
    A structure declarator.

    Attributes
    ----------
    tpname : str
        Name of the structure. (None for unnamed struct)
    fields : [Declarator]
        Content of the structure.
    inherit : str
        Parent class of current structure.
    NcCs||_||_||_dS)z&Initialize the structure declarator.  N)�tpname�fields�inherit)r	rMrNrOrrrr%�s
zStruct.__init__cs�fdd�}|�dfS)z See Declarator.get_decl_pair.c3sl�d}�jdur|�j7}�jdur|d�j7}|VdV�jD]}|��D]}d|Vq(q"dVdS)z2 Iterator generating lines for struct definition. zstruct Nz : �{�  z} )rMrOrNr)�decl�f�f_linerrr�get_tp�s�



�
z$Struct.get_decl_pair.<locals>.get_tprr)r	rUrrrr�s

zStruct.get_decl_pairr!r'rrrrrL�s

rLcs&eZdZ�fdd�Zddd�Z�ZS)�Templatec�tt|��|�||_dSr!)�superrVr%�
template_spec)r	rYr+��	__class__rrr%��
zTemplate.__init__FccsJ�dd�|j�V|j�|�D]}|Vqt|jttf�s#dVdSdS)Nz
template <%s>rGr)rrYr+r�
isinstancerVrD)r	r
�irrrr�s�
�zTemplate.generate)F)rrrr%r�
__classcell__rrrZrrV�srVc@�eZdZddd�Zdd�ZdS)�
ExceptHandlerNcC�||_||_||_dSr!)r$�body�alias)r	r$rcrdrrrr%��
zExceptHandler.__init__ccsD�|jdur
dVnd|j|jpdfV|j��D]}|VqdS)Nz
catch(...)z%catch (pythonic::types::%s const& %s)r)r$rdrcr�r	rrrrr�s�
��zExceptHandler.generater!�rrrr%rrrrrra�r=rac@rC)�	TryExceptcCr r!)�try_�except_)r	rirjrrrr%�r&zTryExcept.__init__ccsF�dV|j��D]}|Vq	|jD]}|��D]}d|VqqdS)N�tryrQ)rirrj)r	r�	exceptionrrrr�s�
��zTryExcept.generateNrgrrrrrh��rhc@r`)�IfNcCrbr!)�	condition�then_�else_)r	rorprqrrrr%�rezIf.__init__ccsR�d|jV|j��D]}|Vq|jdur%dV|j��D]}|VqdSdS)Nzif (%s)�else)rorprrqrfrrrr�s�
�zIf.generater!rgrrrrrn�r=rnc@rC)�LoopcCr*r!�rc�r	rcrrrr%�r-z
Loop.__init__ccs&�|��V|j��D]}|VqdSr!)�
intro_linercrrfrrrr�s
�
�z
Loop.generateNrgrrrrrs��rsc�$eZdZ�fdd�Zdd�Z�ZS)�WhilecrWr!)rXryr%ro)r	rorcrZrrr%�r\zWhile.__init__cCs
d|jS)Nz
while (%s))rorrrrrvr-zWhile.intro_line�rrrr%rvr_rrrZrry�srycrx)�Forcs&tt|��|�||_||_||_dSr!)rXr{r%�startro�update)r	r|ror}rcrZrrr%s
zFor.__init__cCsd|j|j|jfS)Nzfor (%s; %s; %s))r|ror}rrrrrvszFor.intro_linerzrrrZrr{sr{crx)�AutoForcs tt|��|�||_||_dSr!)rXr~r%�targetr4)r	r�iter_rcrZrrr%s
zAutoFor.__init__cCs*|jdkr
d�|j|j�Sd�|j|j�S)N�_z$for (PYTHRAN_UNUSED auto&& {0}: {1})zfor (auto&& {0}: {1}))r�formatr4rrrrrvs
zAutoFor.intro_linerzrrrZrr~sr~c@rC)�DefinecCr r!��symbol�value)r	r�r�rrrr%!r&zDefine.__init__cc��d|j|jfVdS)Nz
#define %s %sr�rrrrr%��zDefine.generateNrgrrrrr� rmr�c@r0)�IncludeTcCr r!)�filename�system)r	r�r�rrrr%*r&zInclude.__init__ccs(�|jrd|jVdSd|jVdS)Nz
#include <%s>z
#include "%s")r�r�rrrrr.s�zInclude.generateNr
rgrrrrr�)�
r�c@rC)�LabelcCr*r!��label)r	r�rrrr%6r-zLabel.__init__cc��|jdVdS)Nz:;r�rrrrr9��zLabel.generateNrgrrrrr�5rwr�c@rC)�	StatementcCr*r!��text�r	r�rrrr%>r-zStatement.__init__ccr�)Nrr�rrrrrAr�zStatement.generateNrgrrrrr�=rwr�c@rC)�AnnotatedStatementcCr r!)�stmt�annotations)r	r�r�rrrr%Fr&zAnnotatedStatement.__init__ccs@�|jD]}d|j}|j|j�Vq|j��D]}|VqdS)Nz#pragma )r��sr��depsr�r)r	�	directive�pragmar�rrrrJs�

�zAnnotatedStatement.generateNrgrrrrr�Ermr�c@r>)�ReturnStatementccs�d|jdVdS)Nzreturn rr�rrrrrSs�zReturnStatement.generateNrrrrrr�RrBr�c@r>)�EmptyStatementcCst�|d�dSr)r�r%rrrrr%X�zEmptyStatement.__init__NrArrrrr�WrBr�c@rC)�AssigncCr r!��lvalue�rvalue)r	r�r�rrrr%]r&zAssign.__init__ccr�)Nz%s = %s;r�rrrrrar�zAssign.generateNrgrrrrr�\rmr�c@r0)�LinercCr*r!r�r�rrrr%fr-z
Line.__init__ccs�|jVdSr!r�rrrrris�z
Line.generateN)rrgrrrrr�es
r�c@rC)�FunctionBodycCs||_||_dS)z�Initialize a function definition. *fdecl* is expected to be
        a :class:`FunctionDeclaration` instance, while *body* is a
        :class:`Block`.
        N)�fdeclrc)r	r�rcrrrr%os
zFunctionBody.__init__ccs6�|jjdd�D]}|Vq|j��D]}|VqdS)NF)r
)r�rrc)r	rT�b_linerrrrws��zFunctionBody.generateNrgrrrrr�nsr�c@r`)�BlockNcCs|durg}||_dSr!)�contents)r	r�rrrr%�s
zBlock.__init__ccs6�dV|jD]}|��D]}d|Vq
qdVdS)NrPrQ�}�r�r�r	�item�	item_linerrrr�s�
�
zBlock.generater!rgrrrrr�r=r�c@r>)�Moduleccs&�|jD]}|��D]}|Vq
qdSr!r�)r	�crrrrr�s�
��zModule.generateNrrrrrr��rBr�c@r`)�	NamespaceNcCst�||�||_dSr!)r�r%r$)r	r$r�rrrr%�s
zNamespace.__init__ccsB�d|jVdV|jD]}|��D]}d|Vqq
dVdS)Nz
namespace rPrQr�)r$r�rr�rrrr�s�
�
zNamespace.generater!rgrrrrr��r�r�c@sheZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�PythonModulezO
    Wraps the creation of a Pythran module wrapped a Python native Module
    cCsd||_g|_g|_i|_g|_g|_g|_g|_g|_||_	||_
|�|j	�dd��}||j
d<dS)z.
        Builds an empty PythonModule
        Nr�	moduledoc)
r$�preamble�includes�	functions�global_vars�implems�capsules�python_implems�wrappers�
docstrings�metadata�	docstring�get)r	r$r�r�r�rrrr%�szPythonModule.__init__cCs&|�t|��dd��dd��dd��S)N�"z\"�
�\n�
z\r)�splitstringr�replace�r	�docrrrr��s�zPythonModule.docstringcCsd�d�|�d���S)Nz"{}"z\n""r�)r�r�splitr�rrrr���zPythonModule.splitstringcG�|j�|�dSr!)r��extend)r	�parrr�add_to_preamble�r�zPythonModule.add_to_preamblecGr�r!)r�r�)r	�inclrrr�add_to_includes�r�zPythonModule.add_to_includescC�|�|j||||�dSr!)�add_function_tor��r	�funcr$�types�	signaturerrr�add_pyfunction��zPythonModule.add_pyfunctioncCs |j�||f�|j�|�dSr!)r��appendr�)r	r��ptrname�sigrrr�add_capsule�szPythonModule.add_capsulecCr�r!)r�r�r�rrr�add_function�r�zPythonModule.add_functionc
Cs|�|�g}g}td|jj}t|�D]\}	}
|�d�|
|	��|�d�|
|	��q|jjdt|��}d�dd�|D��}t	d�}
|j
�|
j|jj|rPdnd	t|�d
t|�d�dd�tt|��D��d�|�d
�|�ppd||d�	�|||f}|j�
|g��|�dS)ab
        Add a function to be exposed. *func* is expected to be a
        :class:`cgen.FunctionBody`.

        Because a function can have several signatures exported,
        this method actually creates a wrapper for each specialization
        and a global wrapper that checks the argument types and
        runs the correct candidate, if any
        �wrap_zfrom_python<{}>(args_obj[{}])z is_convertible<{}>(args_obj[{}])Nrcss�|]	}d�|j�VqdS)z"{}", N)r�r$)rH�argrrrrJ�s�z/PythonModule.add_function_to.<locals>.<genexpr>ac
            static PyObject *
            {wname}(PyObject *self, PyObject *args, PyObject *kw)
            {{
                PyObject* args_obj[{size}+1];
                {silent_warning}
                char const* keywords[] = {{{keywords} nullptr}};
                if(! PyArg_ParseTupleAndKeywords(args, kw, "{fmt}",
                                                 (char**)keywords {objs}))
                    return nullptr;
                if({checks})
                    return to_python({name}({args}));
                else {{
                    return nullptr;
                }}
            }}z(void)args_obj;�Ocss�|]}d|VqdS)z, &args_obj[%d]Nr)rHr^rrrrJs��rGz && �1)	r$�silent_warning�size�fmt�objs�args�checks�wname�keywords)r�rr�r$�	enumerater�rE�lenrrr��ranger��
setdefault)r	�tor�r$�ctypesr��
args_unboxing�args_checks�wrapper_namer^�trEr��wrapper�func_descriptorrrrr��s4






���
zPythonModule.add_function_tocCs,|j�|�|j�td|d�|���dS)Nzstatic PyObject* z
to_python({}))r�r�r�r�r�)r	r$�initrrr�add_global_var"s
�zPythonModule.add_global_varcCs�g}g}g}|jD]
}|�d�|��q	|j��D]`\}}g}g}|D]\}	}
}tdj|	d��}|�|�|�|�q#t||�}
td|}tdj|d�|�|�	|
�
dd��|d��}|�|j�
|d	��}td
j|||d��}|�|�|�|�q|jD]\}}dj||d
�}|�|�q}tdjd	�dd�|D��d��}tdjd|jd�|�d�|j���}|j|j|jtd�g|jdd�|j|D�t|�t|�td�g}d�t|����S)zRGenerate (i.e. yield) the source code of the
        module line-by-line.
        z*PyModule_AddObject(theModule, "{0}", {0});z�
                    if(PyObject* obj = {name}(self, args, kw))
                        return obj;
                    PyErr_Clear();
                    )r$�wrapall_a�
            static PyObject *
            {wname}(PyObject *self, PyObject *args, PyObject *kw)
            {{
                return pythonic::handle_python_exception([self, args, kw]()
                -> PyObject* {{
                {tryall}
                return pythonic::python::raise_invalid_argument(
                               "{name}", {candidates}, args, kw);
                }});
            }}
            r�r�)r$�tryall�
candidatesr�rz�{{
                "{name}",
                (PyCFunction){wname},
                METH_VARARGS | METH_KEYWORDS,
                {doc}}})r$r�r�z�
            PyModule_AddObject(theModule, "{ptrname}",
                               PyCapsule_New((void*)&{ptrname}, "{sig}", NULL)
            );)r�r�z�
            static PyMethodDef Methods[] = {{
                {methods}
                {{NULL, NULL, 0, NULL}}
            }};
            css�|]}|dVqdS)�,Nr)rH�mrrrrJlrKz'PythonModule.__str__.<locals>.<genexpr>)�methodsa�
            #if PY_MAJOR_VERSION >= 3
              static struct PyModuleDef moduledef = {{
                PyModuleDef_HEAD_INIT,
                "{name}",            /* m_name */
                {moduledoc},         /* m_doc */
                -1,                  /* m_size */
                Methods,             /* m_methods */
                NULL,                /* m_reload */
                NULL,                /* m_traverse */
                NULL,                /* m_clear */
                NULL,                /* m_free */
              }};
            #define PYTHRAN_RETURN return theModule
            #define PYTHRAN_MODULE_INIT(s) PyInit_##s
            #else
            #define PYTHRAN_RETURN return
            #define PYTHRAN_MODULE_INIT(s) init##s
            #endif
            PyMODINIT_FUNC
            PYTHRAN_MODULE_INIT({name})(void)
            #ifndef _WIN32
            __attribute__ ((visibility("default")))
            #if defined(GNUC) && !defined(__clang__)
            __attribute__ ((externally_visible))
            #endif
            #endif
            ;
            PyMODINIT_FUNC
            PYTHRAN_MODULE_INIT({name})(void) {{
                import_array()
                #if PY_MAJOR_VERSION >= 3
                PyObject* theModule = PyModule_Create(&moduledef);
                #else
                PyObject* theModule = Py_InitModule3("{name}",
                                                     Methods,
                                                     {moduledoc}
                );
                #endif
                if(! theModule)
                    PYTHRAN_RETURN;
                PyObject * theDoc = Py_BuildValue("(sss)",
                                                  "{version}",
                                                  "{date}",
                                                  "{hash}");
                if(! theDoc)
                    PYTHRAN_RETURN;
                PyModule_AddObject(theModule,
                                   "__pythran__",
                                   theDoc);

                {extraobjects}
                PYTHRAN_RETURN;
            }}
            )r$�extraobjectsz#ifdef ENABLE_PYTHON_MODULEcSsg|]}t|��qSr)r�)rH�coderrr�
<listcomp>�sz(PythonModule.__str__.<locals>.<listcomp>z#endifNr)r�r�r�r��itemsrrrrr�r�r�r�r�r�r$r�r�r�r�r�r�r�r�r)r	�
themethods�theextraobjects�theoverloads�vname�fname�	overloadsr��
signatures�overloadr�r�rir�r��	candidate�fdoc�	themethodr�r��capsuler��modulercrrr�__str__'s�
��


���
��6�6�8�:������zPythonModule.__str__N)rrrr(r%r�r�r�r�r�r�r�r�r�rrrrrr��s7r�c@rC)�CompilationUnitcCr*r!rtrurrrr%�r-zCompilationUnit.__init__cCsd�dd�|jD��S)Nr�css�|]
}d�|���VqdS)r�N)rr)rHr�rrrrJ�s�z*CompilationUnit.__str__.<locals>.<genexpr>)rrcrrrrr�r�zCompilationUnit.__str__N)rrrr%rrrrrr�srN)(r(�textwrapr�pythran.tablesr�pythran.specr�
__copyright__�objectrrrr)r1r?rDrLrVrarhrnrsryr{r~r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr�<module>sJ(
		
		(x

Youez - 2016 - github.com/yon3zu
LinuXploit