o
    à8Va
  ã                   @   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   ó"   t dt| tƒrt| ƒgƒS | gƒS )z9 Generate of FunctionCall instance for calling 'alignof' Úalignof©r	   Ú
isinstanceÚstrr   ©Úarg© r   ú6/usr/lib/python3/dist-packages/sympy/codegen/cnodes.pyr      s   "r   c                 C   r   )a   Generate of FunctionCall instance for calling 'sizeof'

    Examples
    ========

    >>> from sympy.codegen.ast import real
    >>> from sympy.codegen.cnodes import sizeof
    >>> from sympy.printing 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| gdd„ |D ƒ¢R Ž S )Nc                 S   ó   g | ]}t |ƒ‘qS r   r   ©Ú.0r   r   r   r   Ú
<listcomp>+   ó    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                   @   ó,   e Zd ZdZdZdeiZeZe	dd„ ƒZ
dS )ÚLabelaQ   Label for use with e.g. goto statement.

    Examples
    ========

    >>> from sympy import Symbol
    >>> from sympy.codegen.cnodes import Label, PreIncrement
    >>> from sympy.printing import ccode
    >>> 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 )N)r   r
   )r&   Úitrr   r   r   Ú_construct_bodyB   s   
zLabel._construct_bodyN)r(   r)   r*   r+   Ú	__slots__r   Údefaultsr   Ú_construct_nameÚclassmethodr1   r   r   r   r   r-   .   s    r-   c                   @   s   e Zd ZdZdZeZdS )Úgotoz Represents goto in C )ZlabelN)r(   r)   r*   r+   r2   r-   Z_construct_labelr   r   r   r   r6   J   s    r6   c                   @   ó   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.printing import ccode
    >>> ccode(PreDecrement(x))
    '--(x)'

    é   N©r(   r)   r*   r+   Únargsr   r   r   r   r8   P   s    r8   c                   @   r7   )ÚPostDecrementz( Represents the post-decrement operator r9   Nr:   r   r   r   r   r<   `   ó    r<   c                   @   r7   )ÚPreIncrementz' Represents the pre-increment operator r9   Nr:   r   r   r   r   r>   e   r=   r>   c                   @   r7   )ÚPostIncrementz( Represents the post-increment operator r9   Nr:   r   r   r   r   r?   j   r=   r?   c                   @   r,   )Ústructz Represents a struct in C )r.   Zdeclarationsr.   c                 C   s   t dd„ |D ƒŽ S )Nc                 S   r   r   )r   r    r   r   r   r"   w   r#   z2struct._construct_declarations.<locals>.<listcomp>r   r%   r   r   r   Ú_construct_declarationsu   s   zstruct._construct_declarationsN)r(   r)   r*   r+   r2   r   r3   r   r4   r5   rA   r   r   r   r   r@   o   s    r@   c                   @   s   e Zd ZdZdS )Úunionz Represents a union in C N)r(   r)   r*   r+   r   r   r   r   rB   z   s    rB   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-   r6   r8   r<   r>   r?   r@   rB   r   r   r   r   Ú<module>   s(    ,