ó
ù“Fac           @   s  d  Z  d d l m Z d d l m Z d d l Td „  Z d „  Z d „  Z d „  Z	 d	 „  Z
 d
 „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z i e d 6e d 6e d 6e	 d 6e
 d 6e d 6e d 6e d 6e d 6e d 6e d 6e d 6e d 6Z d „  Z d  S(!   s  
XML parser.  One function for each top-level element in the schema.

Most functions just declare a new object and add it to the module.
For typedefs, eventcopies, xidtypes, and other aliases though,
we do not create a new type object, we just record the existing one under a new name.
iÿÿÿÿ(   t   join(   t   parse(   t   *c         C   s£   d d l  m } | j d | _ t | j d |  j ƒ } t | ƒ j ƒ  } | j | ƒ } t	 | | ƒ | j d | _ | j
 |  j ƒ sŸ | j |  j | ƒ n  d S(   s   
    For imports, we load the file, create a new namespace object,
    execute recursively, then record the import (for header files, etc.)
    iÿÿÿÿ(   t   statei   s   %s.xmlN(   t   xcbgenR   t   import_levelR    t   dirt   textR   t   getroott	   Namespacet   executet
   has_importt
   add_import(   t   nodet   modulet	   namespaceR   t   new_filet   new_roott   new_namespace(    (    s2   /usr/lib/python2.7/site-packages/xcbgen/matcher.pyt   import_   s    c         C   sT   |  j  d ƒ } | j | f } | j |  j  d ƒ ƒ } | j | | j | | ƒ d  S(   Nt   newnamet   oldname(   t   gett   prefixt   get_typet   add_typet   ns(   R   R   R   t   idt   namet   type(    (    s2   /usr/lib/python2.7/site-packages/xcbgen/matcher.pyt   typedef   s    c         C   sK   |  j  d ƒ } | j | f } | j d ƒ } | j | | j | | ƒ d  S(   NR   t   CARD32(   R   R   R   R   R   (   R   R   R   R   R   R   (    (    s2   /usr/lib/python2.7/site-packages/xcbgen/matcher.pyt   xidtype$   s    c         C   sK   |  j  d ƒ } | j | f } | j d ƒ } | j | | j | | ƒ d  S(   NR   R   (   R   R   R   R   R   (   R   R   R   R   R   R   (    (    s2   /usr/lib/python2.7/site-packages/xcbgen/matcher.pyt   xidunion*   s    c         C   sK   |  j  d ƒ } | j | f } t | |  ƒ } | j | | j | | ƒ d  S(   NR   (   R   R   t   EnumR   R   (   R   R   R   R   R   R   (    (    s2   /usr/lib/python2.7/site-packages/xcbgen/matcher.pyt   enum0   s    c         C   sK   |  j  d ƒ } | j | f } t | |  ƒ } | j | | j | | ƒ d  S(   NR   (   R   R   t   StructR   R   (   R   R   R   R   R   R   (    (    s2   /usr/lib/python2.7/site-packages/xcbgen/matcher.pyt   struct6   s    c         C   sK   |  j  d ƒ } | j | f } t | |  ƒ } | j | | j | | ƒ d  S(   NR   (   R   R   t   EventStructR   R   (   R   R   R   R   R   R   (    (    s2   /usr/lib/python2.7/site-packages/xcbgen/matcher.pyt   eventstruct<   s    c         C   sK   |  j  d ƒ } | j | f } t | |  ƒ } | j | | j | | ƒ d  S(   NR   (   R   R   t   UnionR   R   (   R   R   R   R   R   R   (    (    s2   /usr/lib/python2.7/site-packages/xcbgen/matcher.pyt   unionB   s    c         C   sE   |  j  d ƒ } | j | f } t | |  ƒ } | j | | | ƒ d  S(   NR   (   R   R   t   Requestt   add_request(   R   R   R   R   R   R   (    (    s2   /usr/lib/python2.7/site-packages/xcbgen/matcher.pyt   requestH   s    c         C   sa   |  j  d ƒ } | j | f } t | |  ƒ } | j |  j  d ƒ | t ƒ | j | | | ƒ d  S(   NR   t   number(   R   R   t   Eventt
   add_opcodet   Truet	   add_event(   R   R   R   R   R   t   event(    (    s2   /usr/lib/python2.7/site-packages/xcbgen/matcher.pyR2   N   s
    c         C   sj   |  j  d ƒ } | j | f } | j |  j  d ƒ ƒ } | j |  j  d ƒ | t ƒ | j | | | ƒ d  S(   NR   t   refR-   (   R   R   t	   get_eventR/   t   FalseR1   (   R   R   R   R   R   R2   (    (    s2   /usr/lib/python2.7/site-packages/xcbgen/matcher.pyt	   eventcopyU   s
    c         C   sa   |  j  d ƒ } | j | f } t | |  ƒ } | j |  j  d ƒ | t ƒ | j | | | ƒ d  S(   NR   R-   (   R   R   t   ErrorR/   R0   t	   add_error(   R   R   R   R   R   t   error(    (    s2   /usr/lib/python2.7/site-packages/xcbgen/matcher.pyR9   \   s
    c         C   sj   |  j  d ƒ } | j | f } | j |  j  d ƒ ƒ } | j |  j  d ƒ | t ƒ | j | | | ƒ d  S(   NR   R3   R-   (   R   R   t	   get_errorR/   R5   R8   (   R   R   R   R   R   R9   (    (    s2   /usr/lib/python2.7/site-packages/xcbgen/matcher.pyt	   errorcopyc   s
    t   importR   R    R!   R#   R%   R'   R)   R,   R2   R6   R9   R;   c         C   s5   x. t  | j ƒ D] } t | j | |  | ƒ q Wd  S(   N(   t   listt   roott   funcst   tag(   R   R   t   elt(    (    s2   /usr/lib/python2.7/site-packages/xcbgen/matcher.pyR
   x   s    N(   t   __doc__t   os.pathR    t   xml.etree.cElementTreeR   t   xcbgen.xtypesR   R   R    R!   R#   R%   R'   R)   R,   R2   R6   R9   R;   R?   R
   (    (    (    s2   /usr/lib/python2.7/site-packages/xcbgen/matcher.pyt   <module>   s<   
													

