
    MZd                     j   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
 Zd Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Zy)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                 \    t        dt        | t              rt        |       g      S | g      S )z9 Generate of FunctionCall instance for calling 'alignof' alignofr
   
isinstancestrr   args    6/usr/lib/python3/dist-packages/sympy/codegen/cnodes.pyr   r      s*    	:c33GF3K#QRRS#QRR    c                 \    t        dt        | t              rt        |       g      S | 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   s    r   r   r      s,     *S#2F6#;"PQQC"PQQr   c                       e Zd ZdZd Zy)CommaOperatorz$ Represents the comma operator in C c           	      f    t        j                  | g|D cg c]  }t        |       c} S c c}w N)r   __new__r   clsargsr   s      r   r"   zCommaOperator.__new__*   s(    }}SBD#ASGCL#ABB#As   .
N)__name__
__module____qualname____doc__r"    r   r   r   r   (   s    .Cr   r   c                   4    e Zd ZdZdxZZdeiZeZ	e
d        Zy)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                 6    t        |t              r|S t        | S r!   )r   r   )r$   itrs     r   _construct_bodyzLabel._construct_bodyA   s    c9%Jc?"r   N)r&   r'   r(   r)   	__slots___fieldsr	   defaultsr   _construct_nameclassmethodr1   r*   r   r   r,   r,   .   s3     +*I~HO# #r   r,   c                       e Zd ZdZdxZZeZy)gotoz Represents goto in C )labelN)r&   r'   r(   r)   r2   r3   r,   _construct_labelr*   r   r   r8   r8   I   s     $$Ir   r8   c                       e Zd ZdZdZy)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<   r<   O   s     Er   r<   c                       e Zd ZdZdZy)PostDecrementz( Represents the post-decrement operator r=   Nr>   r*   r   r   rA   rA   _   
    2Er   rA   c                       e Zd ZdZdZy)PreIncrementz' Represents the pre-increment operator r=   Nr>   r*   r   r   rD   rD   d   s
    1Er   rD   c                       e Zd ZdZdZy)PostIncrementz( Represents the post-increment operator r=   Nr>   r*   r   r   rF   rF   i   rB   r   rF   c                   4    e Zd ZdZdxZZdeiZeZ	e
d        Zy)structz Represents a struct in C )r-   declarationsr-   c                 J    t        |D cg c]  }t        |       c} S c c}w r!   )r   r   r#   s      r   _construct_declarationszstruct._construct_declarationst   s     48C{3'8998s    N)r&   r'   r(   r)   r2   r3   r	   r4   r   r5   r6   rK   r*   r   r   rH   rH   n   s/    $22I~HO: :r   rH   c                       e Zd ZdZdZy)unionz Represents a union in C r*   N)r&   r'   r(   r)   r2   r*   r   r   rM   rM   y   s
    #Ir   rM   N) r)   sympy.codegen.astr   r   r   r   r   r   r	   r
   r   sympy.core.basicr   sympy.core.containersr   sympy.core.sympifyr   r   r   r   r   r   r   r   r,   r8   r<   rA   rD   rF   rH   rM   r*   r   r   <module>rR      s      # ' &F|Z Z 	8	S
RCE C#D #65 5  E 
5 
E 
:T :F r   