o
    _ØfÅ  ã                   @   sà   	 d dl mZ d dlmZ edd… dkrd dlmZ nd dlmZ d dlT dd	„ Zd
d„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zd d!„ Zee	e
eeeeeeeeeed"œZd#d$„ ZdS )%é    )Újoin)Úversion_infoNé   )é   r   )Úparse)Ú*c                 C   sz   	 ddl m} |jd |_t|jd| j ƒ}t|ƒ ¡ }| |¡}t	||ƒ |jd |_| 
| j¡s;| | j|¡ d S d S )Nr   )Ústateé   z%s.xml)Zxcbgenr   Zimport_levelr   ÚdirÚtextr   ZgetrootZ	NamespaceÚexecuteZ
has_importZ
add_import)ÚnodeÚmoduleÚ	namespacer   Znew_fileZnew_rootZnew_namespace© r   úe/home/ych/rk3568/buildroot/output/rockchip_rk3568/host/lib/python3.10/site-packages/xcbgen/matcher.pyÚimport_   s   

ÿr   c                 C   s<   |   d¡}|j|f }| |   d¡¡}| ||j||¡ d S )NZnewnameZoldname©ÚgetÚprefixZget_typeÚadd_typeÚns©r   r   r   ÚidÚnameÚtyper   r   r   Útypedef#   s   
r   c                 C   ó6   |   d¡}|j|f }| d¡}| ||j||¡ d S ©Nr   ZCARD32r   r   r   r   r   Úxidtype)   ó   

r   c                 C   r   r   r   r   r   r   r   Úxidunion/   r    r!   c                 C   ó6   |   d¡}|j|f }t|| ƒ}| ||j||¡ d S ©Nr   )r   r   ÚEnumr   r   r   r   r   r   Úenum5   r    r%   c                 C   r"   r#   )r   r   ZStructr   r   r   r   r   r   Ústruct;   r    r&   c                 C   r"   r#   )r   r   ZEventStructr   r   r   r   r   r   ÚeventstructA   r    r'   c                 C   r"   r#   )r   r   ZUnionr   r   r   r   r   r   ÚunionG   r    r(   c                 C   s2   |   d¡}|j|f }t|| ƒ}| |||¡ d S r#   )r   r   ZRequestZadd_requestr   r   r   r   ÚrequestM   s   

r)   c                 C   óF   |   d¡}|j|f }t|| ƒ}| |   d¡|d¡ | |||¡ d S ©Nr   ÚnumberT)r   r   ZEventÚ
add_opcodeÚ	add_event©r   r   r   r   r   Úeventr   r   r   r0   S   ó
   

r0   c                 C   óL   |   d¡}|j|f }| |   d¡¡}| |   d¡|d¡ | |||¡ d S ©Nr   Úrefr,   F)r   r   Z	get_eventr-   r.   r/   r   r   r   Ú	eventcopyZ   ó
   
r5   c                 C   r*   r+   )r   r   ÚErrorr-   Ú	add_error©r   r   r   r   r   Úerrorr   r   r   r:   a   r1   r:   c                 C   r2   r3   )r   r   Z	get_errorr-   r8   r9   r   r   r   Ú	errorcopyh   r6   r;   )Úimportr   r   r!   r%   r&   r'   r(   r)   r0   r5   r:   r;   c                 C   s&   t |jƒD ]}t|j || |ƒ qd S )N)ÚlistÚrootÚfuncsÚtag)r   r   Úeltr   r   r   r   }   s   ÿr   )Zos.pathr   Úsysr   Zxml.etree.ElementTreer   Zxml.etree.cElementTreeZxcbgen.xtypesr   r   r   r!   r%   r&   r'   r(   r)   r0   r5   r:   r;   r?   r   r   r   r   r   Ú<module>   sF    ô