U
    ZÊ¹jQ  ã                   @   s  d Z ddlmZmZmZmZmZmZmZm	Z	m
Z
 ddlmZ ddlmZ ddlmZ edƒZedƒZedƒZed	ƒZd
d„ Zdd„ ZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZd S )!z1
AST nodes specific to the C family of languages
é    )	Ú	AttributeÚDeclarationÚNodeÚStringÚTokenÚTypeÚnoneÚFunctionCallÚ	CodeBlock)ÚBasic©ÚTuple©ÚsympifyÚvoidÚrestrictÚvolatileÚstaticc                 C   s   t dt| tƒrt| ƒn| gƒS )z9 Generate of FunctionCall instance for calling 'alignof' Úalignof©r	   Ú
isinstanceÚstrr   ©Úarg© r   úS/var/www/html/bwave/python/venv/lib/python3.8/site-packages/sympy/codegen/cnodes.pyr      s    r   c                 C   s   t dt| tƒrt| ƒn| gƒS )a   Generate of FunctionCall instance for calling 'sizeof'

    Examples
    ========

    >>> from sympy.codegen.ast import real
    >>> from sympy.codegen.cnodes import sizeof
    >>> from sympy import ccode
    >>> ccode(sizeof(real))
    'sizeof(double)'
    Úsizeofr   r   r   r   r   r      s    r   c                   @   s   e Zd ZdZdd„ ZdS )ÚCommaOperatorz$ Represents the comma operator in C c                 G   s   t j| fdd„ |D ƒžŽ S )Nc                 S   s   g | ]}t |ƒ‘qS r   r   ©Ú.0r   r   r   r   Ú
<listcomp>+   s     z)CommaOperator.__new__.<locals>.<listcomp>)r   Ú__new__©ÚclsÚargsr   r   r   r!   *   s    zCommaOperator.__new__N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r!   r   r   r   r   r   (   s   r   c                   @   s0   e Zd ZdZd ZZdeiZeZ	e
dd„ ƒZdS )ÚLabela/   Label for use with e.g. goto statement.

    Examples
    ========

    >>> from sympy import ccode, Symbol
    >>> from sympy.codegen.cnodes import Label, PreIncrement
    >>> print(ccode(Label('foo')))
    foo:
    >>> print(ccode(Label('bar', [PreIncrement(Symbol('a'))])))
    bar:
    ++(a);

    )ÚnameÚbodyr+   c                 C   s   t |tƒr|S t|Ž S d S )N)r   r
   )r#   Zitrr   r   r   Ú_construct_bodyA   s    
zLabel._construct_bodyN)r%   r&   r'   r(   Ú	__slots__Ú_fieldsr   Údefaultsr   Ú_construct_nameÚclassmethodr,   r   r   r   r   r)   .   s   r)   c                   @   s   e Zd ZdZd ZZeZdS )Úgotoz Represents goto in C )ÚlabelN)r%   r&   r'   r(   r-   r.   r)   Z_construct_labelr   r   r   r   r2   I   s   r2   c                   @   s   e Zd ZdZdZdS )ÚPreDecrementzé Represents the pre-decrement operator

    Examples
    ========

    >>> from sympy.abc import x
    >>> from sympy.codegen.cnodes import PreDecrement
    >>> from sympy import ccode
    >>> ccode(PreDecrement(x))
    '--(x)'

    é   N©r%   r&   r'   r(   Únargsr   r   r   r   r4   O   s   r4   c                   @   s   e Zd ZdZdZdS )ÚPostDecrementzì Represents the post-decrement operator

    Examples
    ========

    >>> from sympy.abc import x
    >>> from sympy.codegen.cnodes import PostDecrement
    >>> from sympy import ccode
    >>> ccode(PostDecrement(x))
    '(x)--'

    r5   Nr6   r   r   r   r   r8   _   s   r8   c                   @   s   e Zd ZdZdZdS )ÚPreIncrementzé Represents the pre-increment operator

    Examples
    ========

    >>> from sympy.abc import x
    >>> from sympy.codegen.cnodes import PreIncrement
    >>> from sympy import ccode
    >>> ccode(PreIncrement(x))
    '++(x)'

    r5   Nr6   r   r   r   r   r9   o   s   r9   c                   @   s   e Zd ZdZdZdS )ÚPostIncrementzì Represents the post-increment operator

    Examples
    ========

    >>> from sympy.abc import x
    >>> from sympy.codegen.cnodes import PostIncrement
    >>> from sympy import ccode
    >>> ccode(PostIncrement(x))
    '(x)++'

    r5   Nr6   r   r   r   r   r:      s   r:   c                   @   s0   e Zd ZdZd ZZdeiZeZ	e
dd„ ƒZdS )Ústructz Represents a struct in C )r*   Zdeclarationsr*   c                 C   s   t dd„ |D ƒŽ S )Nc                 S   s   g | ]}t |ƒ‘qS r   )r   r   r   r   r   r    —   s     z2struct._construct_declarations.<locals>.<listcomp>r   r"   r   r   r   Ú_construct_declarations•   s    zstruct._construct_declarationsN)r%   r&   r'   r(   r-   r.   r   r/   r   r0   r1   r<   r   r   r   r   r;   �   s   r;   c                   @   s   e Zd ZdZdZdS )Úunionz Represents a union in C r   N)r%   r&   r'   r(   r-   r   r   r   r   r=   š   s   r=   N) r(   Zsympy.codegen.astr   r   r   r   r   r   r   r	   r
   Zsympy.core.basicr   Zsympy.core.containersr   Zsympy.core.sympifyr   r   r   r   r   r   r   r   r)   r2   r4   r8   r9   r:   r;   r=   r   r   r   r   Ú<module>   s&   ,