U
    me                     @   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   8/tmp/pip-unpacked-wheel-rdz2gdd2/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#   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   r3   I   s   r3   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   r5   O   s   r5   c                   @   s   e Zd ZdZdZdS )PostDecrementz( Represents the post-decrement operator r6   Nr7   r   r   r   r   r9   _   s   r9   c                   @   s   e Zd ZdZdZdS )PreIncrementz' Represents the pre-increment operator r6   Nr7   r   r   r   r   r:   d   s   r:   c                   @   s   e Zd ZdZdZdS )PostIncrementz( Represents the post-increment operator r6   Nr7   r   r   r   r   r;   i   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    v   s     z2struct._construct_declarations.<locals>.<listcomp>r   r"   r   r   r   _construct_declarationst   s    zstruct._construct_declarationsN)r%   r&   r'   r(   r.   r/   r   r0   r   r1   r2   r=   r   r   r   r   r<   n   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>   y   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)   r3   r5   r9   r:   r;   r<   r>   r   r   r   r   <module>   s&   ,