Ńň
mČKc        	   @   sč   d  Z  d d k Z d d k Z d d k Td d k l Z d d d d g e Z [ e i e i e i e i	 e
 f Z d d	  Z d d
  Z d d  Z d d d d d  Z e Z d   Z d   Z d   Z e d j o e   n d S(   s0   Disassembler of Python byte code into mnemonics.i˙˙˙˙N(   t   *(   t   __all__t   dist   disassemblet   distbt   discoc         C   s]  |  d j o t   d St |   t i j o |  i }  n t |  d  o |  i }  n t |  d  o |  i }  n t |  d  o |  i	 i
   } | i   xˇ | D]Y \ } } t | t  o= d | GHy t |  Wn t j
 o } d G| GHn XHqŚ qŚ WnS t |  d  o t |   n5 t |  t  o t |   n t d t |   i  d S(	   sn   Disassemble classes, methods, functions, or code.

    With no argument, disassemble the last traceback.

    Nt   im_funct	   func_codet   __dict__s   Disassembly of %s:s   Sorry:t   co_codes(   don't know how to disassemble %s objects(   t   NoneR   t   typet   typest   InstanceTypet	   __class__t   hasattrR   R   R   t   itemst   sortt
   isinstancet
   _have_codeR   t	   TypeErrorR   t   strt   disassemble_stringt   __name__(   t   xR   t   namet   x1t   msg(    (    s   /usr/lib/python2.6/dis.pyR      s8    
 	c         C   sr   |  d j oK y t i }  Wn t j
 o t d  n Xx |  i o |  i }  q< Wn t |  i i |  i	  d S(   s2   Disassemble a traceback (default: last traceback).s    no last traceback to disassembleN(
   R
   t   syst   last_tracebackt   AttributeErrort   RuntimeErrort   tb_nextR   t   tb_framet   f_codet   tb_lasti(   t   tb(    (    s   /usr/lib/python2.6/dis.pyR   2   s     
 c         C   s}  |  i  } t |  } t t |    } t |  } d } d } d } x1| | j  o#| | }	 t |	  }
 | | j o" | d j o Hn d | | Gn d G| | j o d Gn d G| | j o d Gn d Gt |  i d  Gt	 |
 i
 d  G| d	 } |
 t j oht | |  t | | d	  d
 | } d } | d } |
 t j o | d } n t |  i d  G|
 t j o d t |  i |  d Gqs|
 t j o d |  i | d Gqs|
 t j o d t | |  d Gqs|
 t j o d |  i | d Gqs|
 t j o d t | d Gqs|
 t j o5 | d j o |  i |  i } n d | | d Gqsn HqH Wd S(   s   Disassemble a code object.i    s   %3ds      s   -->s   >>s     i   i   i   i   i   l      i   t   (t   )s   (to N(   R	   t
   findlabelst   dictt   findlinestartst   lenR
   t   ordt   reprt   rjustt   opnamet   ljustt   HAVE_ARGUMENTt   EXTENDED_ARGt   hasconstt	   co_constst   hasnamet   co_namest   hasjrelt   haslocalt   co_varnamest
   hascomparet   cmp_opt   hasfreet   co_cellvarst   co_freevars(   t   cot   lastit   codet   labelst
   linestartst   nt   it   extended_argt   freet   ct   opt   oparg(    (    s   /usr/lib/python2.6/dis.pyR   <   s^    	 
  
*
c         C   sň  t  |   } t |   } d } xÍ| | j  oż|  | } t |  }	 | | j o d Gn d G| | j o d Gn d Gt |  i d  Gt |	 i d  G| d } |	 t j o7t |  |  t |  | d  d	 }
 | d
 } t |
  i d  G|	 t j o- | o d t | |
  d Gqäd |
 Gqč|	 t	 j o- | d  j	 o d | |
 d Gqäd |
 Gqč|	 t j o d t | |
  d Gqč|	 t j o' | o d | |
 d Gqäd |
 Gqč|	 t j o d t |
 d Gqčn Hq! Wd  S(   Ni    s   -->s      s   >>s     i   i   i   i   i   i   R%   R&   s   (%d)s   (to (   R'   R*   R+   R,   R-   R.   R/   R0   R2   R4   R
   R6   R7   R9   R:   (   R@   R?   t   varnamest   namest	   constantsRA   RC   RD   RG   RH   RI   (    (    s   /usr/lib/python2.6/dis.pyR   m   sJ     
  
&
c         C   sů   g  } t  |   } d } xÚ | | j  oĚ |  | } t |  } | d } | t j o t |  |  t |  | d  d } | d } d } | t j o | | } n | t j o
 | } n | d j o" | | j o | i |  qě qđ q q W| S(   s`   Detect all offsets in a byte code which are jump targets.

    Return the list of offsets.

    i    i   i   i   i˙˙˙˙(   R*   R+   R0   R6   t   hasjabst   append(   R@   RA   RC   RD   RG   RH   RI   t   label(    (    s   /usr/lib/python2.6/dis.pyR'      s(     

&

c         c   s  g  } |  i  d d d  D] } | t |  q ~ } g  } |  i  d d d  D] } | t |  qR ~ } d } |  i } d } x^ t | |  D]M \ }	 }
 |	 o0 | | j o | | f V| } n | |	 7} n | |
 7} q W| | j o | | f Vn d S(   s   Find the offsets in a byte code which are start of lines in the source.

    Generate pairs (offset, lineno) as described in Python/compile.c.

    i    Ni   i   (   t	   co_lnotabR+   R
   t   co_firstlinenot   zip(   R@   t   _[1]RG   t   byte_incrementst   _[2]t   line_incrementst
   lastlinenot   linenot   addrt	   byte_incrt	   line_incr(    (    s   /usr/lib/python2.6/dis.pyR)   ą   s    77	 
c          C   sć   t  i d o_ t  i d o! t  i i d  t  i d  n t  i d }  |  p |  d j o
 d }  qs n d }  |  d j o t  i } n t |   } | i   } |  d j	 o | i	   n d }  t
 | |  d  } t |  d S(   s*   Simple test program to disassemble a file.i   i   s   usage: python dis.py [-|file]
t   -s   <stdin>t   execN(   R   t   argvt   stderrt   writet   exitR
   t   stdint   opent   readt   closet   compileR   (   t   fnt   ft   sourceR@   (    (    s   /usr/lib/python2.6/dis.pyt   _testÇ   s"    t   __main__(   t   __doc__R   R   t   opcodeR   t   _opcodes_allt
   MethodTypet   FunctionTypet   CodeTypet	   ClassTypeR   R   R
   R   R   R   R   R   R'   R)   Rj   R   (    (    (    s   /usr/lib/python2.6/dis.pyt   <module>   s&   
#
1	'			