ó ÊQ_Tc@sUdZddlmZmZddlZdefd„ƒYZdefd„ƒYZed4d ƒZed5d ƒZ ed6d ƒZ ed7dƒZ ed8d ƒZ ed9d ƒZ ed:d ƒZed;dƒZed<d ƒZed=d ƒZed>dƒZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd „ƒYZd!efd"„ƒYZd#efd$„ƒYZd%efd&„ƒYZd'efd(„ƒYZd)efd*„ƒYZd+efd,„ƒYZd-efd.„ƒYZd/efd0„ƒYZd1efd2„ƒYZ eedƒej"d3e#e$e#ƒZ%dS(?sB This module contains the classes which represent XCB data types. iÿÿÿÿ(tFieldt ExpressionNtTypecBsGeZdZd„Zd„Zd„Zd„Zdd„Zd„Z RS(sm Abstract base class for all XCB data types. Contains default fields, and some abstract methods. cCsy||_d|_d|_t|_t|_t|_t|_t|_ t|_ t|_ t|_ t|_ t|_dS(s§ Default structure initializer. Sets up default fields. Public fields: name is a tuple of strings specifying the full type name. size is the size of the datatype in bytes, or None if variable-sized. nmemb is 1 for non-list types, None for variable-sized lists, otherwise number of elts. booleans for identifying subclasses, because I can't figure out isinstance(). N(tnametNonetsizetnmembtFalsetresolvedt is_simpletis_listtis_exprt is_containertis_replytis_uniontis_padt is_switcht is_bitcase(tselfR((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyt__init__ s            cCstdƒ‚dS(s€ Abstract method for resolving a type. This should make sure any referenced types are already declared. s'abstract resolve method not overridden!N(t Exception(Rtmodule((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pytresolve&scCstdƒ‚dS(sÑ Abstract method for outputting code. These are declared in the language-specific modules, and there must be a dictionary containing them declared when this module is imported! s#abstract out method not overridden!N(R(RR((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pytout-scCstdƒ‚dS(sQ Abstract method for determining if the data type is fixed-size. s*abstract fixed_size method not overridden!N(R(R((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyt fixed_size5sc Csot|||||||ƒ} x:t|jƒD])\} } | tkr.| |j| fƒ|jj |j dƒ|j fƒq;q;WdS( NitdociRttvaluetbits%ui(R1RtvaluestbitsRRAtlistttagtDoctlenRtgetttexttint(RRtelttitemRC((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyRˆs    %3cCs t|_dS(N(R*R(RR((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyRžscCstS(N(R*(R((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyR¡sR#( R.R/R0RRRR3R4R(((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyR@€s    tListTypecBs5eZdZd„Zdd„Zd„Zd„ZRS(sA Derived class which represents a list of some other datatype. Fixed- or variable-sized. Public fields added: member is the datatype of the list elements. parent is the structure type containing the list. expr is an Expression object containing the length information, for variable-sized lists. cGsätj||jƒt|_||_t|ƒ|_|jdkrzt|ƒ}t t |ƒrh|dn||ƒ|_ n$|jdkržt ||ƒ|_ n|j ƒr³|j nd|_ |j j ƒr×|j jnd|_dS(NRGit valueparam(RRRR*R tmemberRGtparentsRHRRJtexprRRRR(RRNRRtparenttelts((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyR°s   +c  Csë|jƒsÂ|jj} |jj} |jj} t} x=|jD]2} x)| jD]}|j| krPt } qPqPWq@W| rÂ|j | ƒ}|j | ƒ}|j |||| t| t |ƒqÂnt j |||||||||ƒ dS(N(RRTt lenfield_typet lenfield_nametlenwireR*RSRRRtget_typeR)R'R(RRRRRR R!R"R#tlenfidRXRYtneedlenRUR&ttypeRW((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyR'¿s    (cCs¥|jr dS|jj|ƒ|jj||jƒ|jƒs˜xV|jD]H}x?|jD]4}|j|jjkrY|j rY||j_ PqYqYWqIWnt |_dS(N( RRRRRTRSRRRRXR!tlenfieldR*(RRRUR&((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyR×s   cCs|jjƒo|jjƒS(N(RRRRT(R((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyRèsN(R.R/R0RRR'RR(((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyRP§s    tExprTypecBs)eZdZd„Zd„Zd„ZRS(s¡ Derived class which represents an exprfield. Fixed size. Public fields added: expr is an Expression object containing the value of the field. cGsctj||jƒt|_||_||_tt|ƒd|ƒ|_ |j |_ d|_ dS(Nii( RRRR*R RRRSRRGRTRR(RRNRRRS((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyRòs    cCs*|jr dS|jj|ƒt|_dS(N(RRRRR*(RR((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyRýs cCstS(N(R*(R((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyRs(R.R/R0RRR(((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyR_ës tPadTypecBs)eZdZd„Zd„Zd„ZRS(s9 Derived class which represents a padding field. cCs†tj|tjƒt|_d|_d|_d|_|dkr‚t |j ddƒdƒ|_t |j ddƒdƒ|_ndS(Nitbytest1italign( RRttcard8RR*RRRRcRRMRK(RRN((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyR s     cCs t|_dS(N(R*R(RR((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyRscCs |jdkS(Ni(Rc(R((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyRs(R.R/R0RRR(((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyR`s t ComplexTypecBs2eZdZd„Zd„Zd„Zd„ZRS(s¼ Derived class which represents a structure. Base type for all structure types. Public fields added: fields is an array of Field objects describing the structure fields. cCsVtj||ƒt|_||_g|_d|_d|_|g|_g|_ dS(Nii( RRR*R RNRRRtlenfield_parenttfds(RRRN((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyR"s      c CsÚ|jr dSd}x­t|jƒD]œ}|jdkrvdt|jƒ}d}t|ƒ}|jd|_t}n |jdkrÊ|j dƒ}|j dƒ}|j dƒ}|j |ƒ}t }n·|jdkr|j dƒ}|j dƒ}t ||j |ƒ|j Œ}t}nc|jd krr|j dƒ}|j dƒ}t||j |ƒ|j Œ}t }n|jd kr½|j d ƒ}d }t||j |ƒ|j Œ}t }nÄ|jd kr8|j dƒ}|j|f}t|||j Œ}t }|j|||||t tƒ|j|ƒq#nI|jdkr#|j dƒ} |j dƒ}|j||| ƒq#nq#|j|ƒ}|j|||||t t|ƒ|j|ƒq#W|jƒt |_dS(NtpadtCARD8iR&RR#R]t exprfieldRGRQsvalue-list-nametCARD32tswitchtfdR((RRRGRNRHtstrtpadsR`RRKRZR*R_RfRPRt SwitchTypeR'RR-R)t calc_size( RRR#tchildRtfkeyR]R RR+((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyR,sd        " cCsld|_x\|jD]Q}|js(qn|jjƒrZ|j|jj|jj|_qd|_PqWdS(Ni(RRR!R]RRR(Rtm((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyRqjs  # cCs+x$|jD]}|jjƒs tSq WtS(N(RR]RRR*(RRt((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyRus(R.R/R0RRRqR(((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyRes  > RpcBs>eZdZd„Zd„Zdd„Zd„Zd„ZRS(s› Derived class which represents a List of Items. Public fields added: bitcases is an array of Bitcase objects describing the list items cGs|tj|||ƒ||_t|ƒ|g|_g|_t|_t|ƒ}tt |ƒri|dn||ƒ|_ dS(Ni( ReRRSRGRftbitcasesR*RRRJRT(RRRNRSRV((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyRƒs    c Cs˜|jr dSt|jƒ|g}x[tt|jƒƒD]D\}}|jdkr9|jdƒ}|dkr†|jd|f}n|j|f}t ||||Œ}|dkrÌt |_ |j}nt }|j |||||t t ƒ|j|ƒt } xv|jD]h} x@t|jƒD]/\} } | tkr$| |j| }|jdkrS|jjt||ƒƒq"|j|ƒq"Wtj|||ƒt|_d|_ t|ƒ|g|_ t|ƒ|_ t|_ dS(Ntenumrefi( RGRTRHRRReRR*RxRyRfRSR(RRyRRNRURVR((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyRøs     c Csot|||||||ƒ} x:t|jƒD])\} } | tkr.| |j| opcode number, for eventcopies. cCs•tj|||ƒi|_t|jdƒƒ |_t|jdƒƒ|_d|_x8t |ƒD]*}|j dkrct ||ƒ|_qcqcWdS(Nsno-sequence-numbertxgeRA( ReRtopcodestboolRKthas_seqt is_ge_eventRRARGRHRI(RRRNRO((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyRos  cCs#||j|<|r||_ndS(N(R’R(RR‰Rtmain((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyt add_opcode|s csY‡fd†}‡fd†}ˆjr+dSˆjr>|ƒn|ƒtjˆ|ƒdS(Ncspˆjjtttjdtttƒƒˆjrlˆjjtƒˆjjtt t jdtttƒƒndS(NRƒR„( RRRRdRRR*R”RR†((R(s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pytadd_event_header‚s( cs̈jjtttjdtttƒƒˆjjtttjdtttƒƒˆjjtttjdtttƒƒˆjjtttjdtttƒƒˆjjtttjdtttƒƒdS(NRƒt extensionR„R…t event_type( RRRRdRRR*R†R‡((R(s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pytadd_ge_event_headerˆs (((((RR•ReR(RRR˜R›((Rs7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyRs   tevent( R.R/R0RR—RR3R4R(((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyRhs   tErrorcBs6eZdZd„Zd„Zd„ZejdZRS(s™ Derived class representing an error data type. Public fields added: opcodes is a dictionary of name -> opcode number, for errorcopies. cCs tj|||ƒi|_dS(N(ReRR’(RRRN((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyR¤scCs#||j|<|r||_ndS(N(R’R(RR‰RR–((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyR—¨s cCs™|jr dS|jjtttjdtttƒƒ|jjtttjdtttƒƒ|jjtttjdtttƒƒt j ||ƒdS(NRƒt error_codeR„( RRRRRdRRR*R†ReR(RR((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyR­s  (((terror( R.R/R0RR—RR3R4R(((s7/usr/local/lib/python2.7/site-packages/xcbgen/xtypes.pyRs    RIcBseZdZd„ZRS(s) Class representing a tag. cCsb||_d|_d|_i|_i|_i|_d|_xt|ƒD]}|j rd|j nd}|j dkr‹|j ƒ|_n|j dkr¬|j ƒ|_n|j dkrÚ|j ƒ|j|j dƒs< T'D`g 1)5