
ƈEGc        %   @   s  d  Z  d d k Z d d k Z d d k Z d d k l Z l Z d d k l Z l	 Z	 d d k i
 Z
 y d d k Td d k l Z Wn e j
 o e d   n Xd d k l Z d d	 k l Z l 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 d Z  d Z d Z! d Z" d Z# e$ d  Z% d Z& d e' f d     YZ( d e' f d     YZ) d e' f d     YZ* d e+ f d     YZ, d e' f d      YZ- d! e' f d"     YZ. d# e' f d$     YZ/ d% e' f d&     YZ0 d' e' f d(     YZ1 d) e' f d*     YZ2 d+ e+ f d,     YZ3 d- e' f d.     YZ4 d/ e' f d0     YZ5 d1 d2 d3 d4 d5 d6 d7 d8 d9 d: d; d< d= d> d? d@ dA dB dC dD dE dF dG dH g Z6 h d e! 6d e" 6d e# 6d dI 6Z7 dJ e8 f dK     YZ9 x* e6 D]" Z: e; e9 e: e< e= i> e:   qWe? g e= i> i@ _A e? eB g e= i> iC _A d dL kD lE ZE e= iF iG ZH dM eE f dN     YZD d dO  ZI eJ eK eK  ZL eJ eK eM eM eK  ZN eO aP eO aQ dP   ZR dQ   ZS dR   ZT eU dS j o d d kV ZV d d k Z dT   ZW e9 d  ZX eX e _Y eX e _Z eX i[   eW dU  GeW dV  GHeX i\ dW dX  eX i] dY  dZ GHx% e^ dX  D] Z_ eX i`   Za ea GHq^W[X n d S([   s~   Cursor control and color for the Windows console.

This was modeled after the C extension of the same name by Fredrik Lundh. 
iN(   t   logt   log_sock(   t   ensure_unicodet
   ensure_str(   t   *(   t   call_functions    You need ctypes to run this code(   t   make_KeyPress(   t	   AnsiStatet
   AnsiWriteriii   i   i   i   i    i   i   i   i   l        i   @t   COORDc           B   s    e  Z d  e f d e f g Z RS(   t   Xt   Y(   t   __name__t
   __module__t   c_shortt   _fields_(    (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyR	   6   s   	t
   SMALL_RECTc           B   s2   e  Z d  e f d e f d e f d e f g Z RS(   t   Leftt   Topt   Rightt   Bottom(   R   R   R   R   (    (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyR   :   s   			t   CONSOLE_SCREEN_BUFFER_INFOc           B   s;   e  Z d  e f d e f d e f d e f d e f g Z RS(   t   dwSizet   dwCursorPositiont   wAttributest   srWindowt   dwMaximumWindowSize(   R   R   R	   R   R   R   (    (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyR   @   s
   				t
   CHAR_UNIONc           B   s    e  Z d  e f d e f g Z RS(   t   UnicodeChart	   AsciiChar(   R   R   t   c_wchart   c_charR   (    (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyR   G   s   	t	   CHAR_INFOc           B   s    e  Z d  e f d e f g Z RS(   t   Chart
   Attributes(   R   R   R   R   R   (    (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyR    K   s   	t   KEY_EVENT_RECORDc        	   B   sV   e  Z d  e f d e f d e f d e f d e f d e f d e f d e f g Z RS(   t   bKeyDownt   pad2t   pad1t   wRepeatCountt   wVirtualKeyCodet   wVirtualScanCodet   uChart   dwControlKeyState(   R   R   t   c_byteR   R   t   c_intR   (    (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyR#   O   s   							t   MOUSE_EVENT_RECORDc           B   s2   e  Z d  e f d e f d e f d e f g Z RS(   t   dwMousePositiont   dwButtonStateR+   t   dwEventFlags(   R   R   R	   R-   R   (    (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyR.   Y   s   			t   WINDOW_BUFFER_SIZE_RECORDc           B   s   e  Z d  e f g Z RS(   R   (   R   R   R	   R   (    (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyR2   _   s   t   MENU_EVENT_RECORDc           B   s   e  Z d  e f g Z RS(   t   dwCommandId(   R   R   t   c_uintR   (    (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyR3   b   s   t   FOCUS_EVENT_RECORDc           B   s   e  Z d  e f g Z RS(   t	   bSetFocus(   R   R   R,   R   (    (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyR6   e   s   t   INPUT_UNIONc           B   s;   e  Z d  e f d e f d e f d e f d e f g Z RS(   t   KeyEventt
   MouseEventt   WindowBufferSizeEventt	   MenuEventt
   FocusEvent(   R   R   R#   R.   R2   R3   R6   R   (    (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyR8   h   s
   				t   INPUT_RECORDc           B   s    e  Z d  e f d e f g Z RS(   t	   EventTypet   Event(   R   R   R   R8   R   (    (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyR>   o   s   	t   CONSOLE_CURSOR_INFOc           B   s    e  Z d  e f d e f g Z RS(   R   t   bVisible(   R   R   R-   R,   R   (    (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyRA   s   s   	t   AllocConsolet   CreateConsoleScreenBuffert   FillConsoleOutputAttributet   FillConsoleOutputCharacterWt   FreeConsolet   GetConsoleCursorInfot   GetConsoleModet   GetConsoleScreenBufferInfot   GetConsoleTitleWt   GetProcAddresst   GetStdHandlet   PeekConsoleInputWt   ReadConsoleInputWt   ScrollConsoleScreenBufferWt   SetConsoleActiveScreenBuffert   SetConsoleCursorInfot   SetConsoleCursorPositiont   SetConsoleModet   SetConsoleScreenBufferSizet   SetConsoleTextAttributet   SetConsoleTitleWt   SetConsoleWindowInfot   WriteConsoleWt   WriteConsoleOutputCharacterWi[   t   Consolec           B   s  e  Z d  Z d d  Z d   Z d   Z d   Z d7 d7 d  Z d   Z	 e
 i d  Z e
 i d	  Z h d d
 6d d 6d d 6d8 d 6d d 6d9 d 6d: d 6d< d 6d> d 6d? d 6d@ d 6dB d 6dC d 6dE d 6dG d 6dJ d 6d7 d 6Z e
 i d  Z d7 d   Z d7 d!  Z d7 d"  Z d7 d#  Z d$   Z d%   Z d&   Z d7 d' d(  Z d7 d)  Z d*   Z d7 d' d+  Z d7 d' d,  Z d-   Z d.   Z d/   Z d0   Z d1   Z d7 d2  Z  d7 d7 d3  Z! d7 d7 d4  Z" d5   Z# d6   Z$ RS(K   s!   Console driver for Windows.

    i    c         C   s  | o6 |  i  t t Bd d	 d d	  |  _ |  i |  i  n |  i t  |  _ |  i t  |  _	 t
 d  |  _ |  i |  i	 t |  i   |  i |  i	 d  t   } |  i |  i t |   | i |  _ | i |  _ t   |  _ | i |  i _ t |  i  |  _ |  i d @} x< |  i D]1 } |  i | d	 j	 o |  i | c | O<qqWt d |  i  d |  _ d |  _ t d t i d t i d f  |  _  t
 i! t" |  i  i#   i$ |  _% t& t' d |  i  i(  d	 S(
   s   Initialize the Console object.

        newbuffer=1 will allocate a new buffer so the old content will be restored
        on exit.
        i    i   i   i   s   initial attr=%xs
   python%s%si   t   PyMem_MallocN()   RD   t   GENERIC_READt   GENERIC_WRITEt   Nonet   houtRQ   RM   t   STD_OUTPUT_HANDLEt   STD_INPUT_HANDLEt   hinR-   t   inmodeRI   t   byrefRT   R   RJ   R   t   attrt   saveattrR   t   defaultstatet   winattrR   t
   ansiwritert   escape_to_colorR    t	   softspacet   serialt   CDLLt   syst   versiont	   pythondllt   from_addresst	   addressoft   PyOS_InputHookt   valuet   inputHookPtrt   setattrR[   R\   (   t   selft	   newbuffert   infot
   backgroundt   escape(    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyt   __init__   s6    	
 		'!c         C   s:   |  i  |  i |  i  |  i |  i |  i  |  i   d S(   s"   Cleanup the console when finished.N(   RV   R`   Rg   RT   Rc   Rd   RG   (   Rx   (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyt   __del__   s    c         C   sG   t    } |  i |  i t |   | i } | i } | i } | | f S(   N(   R   RJ   R`   Re   R   R   R   (   Rx   Rz   t   rectt   topt   bot(    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyt   _get_top_bot   s    				c         C   s   | d j  p | d j  oW t    } |  i |  i t |   | d j  o$ | i i | } | i i | } qq n t | d >| B S(   sG   Return a long with x and y packed inside, also handle negative x and y.i    i   (   R   RJ   R`   Re   R   R   R   R-   (   Rx   t   xt   yRz   (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyt   fixcoord   s    	c         C   si   | d j o9 t   } |  i |  i t |   | i i | i i f S|  i |  i |  i	 | |   Sd S(   s    Move or query the window cursor.N(
   R_   R   RJ   R`   Re   R   R
   R   RS   R   (   Rx   R   R   Rz   (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyt   pos   s
    	c         C   s   |  i  d d  d S(   s   Move to home.i    N(   R   (   Rx   (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyt   home   s    s   (?\[[0-9;]+m?)s   ?\[([0-9;]+)m?s   0;30i   s   0;31i   s   0;32s   0;33i   s   0;34s   0;35s   0;36s   0;37s   1;30i   s   1;31s   1;32s   1;33s   1;34s   1;35s   1;36s   1;37t   0s	   ([
	])c         C   s  |  i    \ } } |  i   \ } } d } |  i i |  } x| D]}	 t d |	  |  i |	 |  }
 t |	  d j o5|	 d d j o d } | d 7} n |	 d d j o
 d } n |	 d d j oA d t | d  d } | | j o | | 8} | d 7} qgnZ |	 d d j o nE |	 d d	 j o) | d 8} | d j  o | d 8} qgn | d 7} | | j o d } | d 7} n | | j o | d 7} | d } qqC | |
 7} t | |  } | | } | | 7} | | j o  | | | d 7} | d } qC qC W| S(
   sh  write text at current cursor position while watching for scrolling.

        If the window scrolls because you are at the bottom of the screen
        buffer, all positions that you are storing will be shifted by the
        scroll amount. For example, I remember the cursor position of the
        prompt so that I can redraw the line but if the window scrolls,
        the remembered position is off.

        This variant of write tries to keep track of the cursor position
        so that it will know when the screen buffer is scrolled. It
        returns the number of lines that the buffer scrolled.

        i    s   C:i   s   
s   s   	i   s   s   (   R   t   sizet   motion_char_ret   splitR    t   write_colort   lent   int(   Rx   t   textRf   R   R   t   wt   ht   scrollt   chunkst   chunkt   nt   l(    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyt   write_scrolling  sP     







c         C   s   t  d | | f  |  i i |  } t  d t |   t d  } d } x | D] } |  i i |  } | o |  i | i d  } qS n | t	 |  7} t  d |  | d j o |  i } n |  i |  i |  qS W| S(   s}   write text at current cursor position and interpret color escapes.

        return the number of characters written.
        s   write_color("%s", %s)s	   chunks=%si    i   s   attr=%sN(   R    t   terminal_escapeR   t   reprR-   t   escape_partst   matchRk   t   groupR   R_   Rf   RV   R`   (   Rx   R   Rf   R   t   junkR   R   t   m(    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyR   K  s"     c         C   s   t  |  } |  i i | |  \ } } t d  } xr | D]j \ } } t t |   t t |   |  i |  i | i  |  i	 |  i | t
 |  t |  d   q: W| S(   Ni    (   R   Rj   R   R-   R    t   unicodeRV   R`   Ri   RY   R   Re   R_   (   Rx   R   Rf   R   t   resR   R   (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyR   b  s     ,c         C   s   t  d | | f  | d j o |  i } n t d  } |  i |  i |  |  i |  i t t  t	 t  t
 t  d  t	 |  S(   s&   write text at current cursor position.s   write("%s", %s)i    N(   R    R_   Rf   R-   RV   R`   RY   R   R   R   Re   R   (   Rx   R   Rf   R   (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyt   write_plainn  s    .c         C   s   t  d |  |  i |  S(   Ns   write("%s")(   R    R   (   Rx   R   (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyt   writey  s    c         C   s   t  S(   N(   t   True(   Rx   (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyt   isatty  s    c         C   s   d  S(   N(    (   Rx   (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyt   flush  s    t    c         C   sJ  | d j o |  i } n t |  d j o
 t  n t   } |  i |  i t |   | i i	 d j p | i i
 d j o# |  i |  i |  i d d   n | i i	 } t d  } x t | i i
  D]l } |  i |  i | | |  i d |  t |   |  i |  i t | d  | |  i d |  t |   q W| |  _ d S(   s   Fill the entire screen.i   i    N(   R_   Rf   R   t
   ValueErrorR   RJ   R`   Re   R   R
   R   RS   R   R   R-   t   rangeRE   RF   t   ord(   Rx   Rf   t   fillRz   R   R   R   (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyt   page  s    
	&# .<c         C   s   | d j o |  i } n |  i | |  } t d  } |  i |  i | t |  | t |   |  i |  i | | | t |   d S(   s!   Write text at the given position.i    N(	   R_   Rf   R   R-   RZ   R`   R   Re   RE   (   Rx   R   R   R   Rf   R   R   (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyR     s    (c         C   s   |  i    \ } } |  i   } |  i   \ } } |  i | d | d | | d d f  | d | j  o) |  i d | d d | | d f  n d  S(   Ni    i   (   R   R   R   t	   rectangle(   Rx   R   R   R   R   R   (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyt   clear_to_end_of_window  s    )c         C   s   | \ } } } } t  d  } | d j o |  i } n x t | |  D]n }	 |  i | |	  }
 |  i |  i | | | |
 t |   |  i |  i t	 | d  | | |
 t |   qH Wd S(   s   Fill Rectangle.i    N(
   R-   R_   Rf   R   R   RE   R`   Re   RF   R   (   Rx   R   Rf   R   t   x0t   y0t   x1t   y1R   R   R   (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyR     s     &c         C   s   | d j o |  i } n | \ } } } }	 t | | | d |	 d  }
 |  i | | | |  } t   } | d | i _ | | _ |  i |  i	 t
 |
  t
 |
  | t
 |   S(   s   Scroll a rectangle.i   i    N(   R_   Rf   R   R   R    R!   R   R"   RP   R`   Re   (   Rx   R   t   dxt   dyRf   R   R   R   R   R   t   sourcet   destt   style(    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyR     s    		c   
      C   s.  t    } |  i |  i t |   | i } t d | i | i f  | i | } | i | } | | } | i i	 d } | d j  o d } | } n | | j o | } | | } n t
   } | | _ | | _ | i | _ | i | _ t d | | f  |  i |  i t t |   }	 t d |	  d S(   s3   Scroll the window by the indicated number of lines.s   sw: rtop=%d rbot=%di   i    s   sn: top=%d bot=%ds   r=%dN(   R   RJ   R`   Re   R   R    R   R   R   R   R   R   R   RX   R   (
   Rx   t   linesRz   R   R   R   R   t   maxbott   nrectt   r(    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyt   scroll_window  s,    		

			c         C   s   t  i |  i  i } t   } t  d  } x | o t | d  n |  i |  i t |  d t |   } | o: | i d j o* t	 |  |  } t
 t | i  d  | Sq- d S(   s   Get next event from queue.i    i   t   keypressN(    (   R-   Rr   Rv   Ru   R>   R   RO   Rc   Re   t   eventR   R   t   keyinfo(   Rx   t   inputHookFunct   Ceventt   countt   statust   e(    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyt   get  s    	'c         C   s   x |  i    } | i d j oj | i t j oZ t |  | i i d j o |  i d  q | i i d j o |  i d  q | Sq | i d j oA | i t t	 t	 d f j o% t d | i | i | i f  | Sq d	 S(
   s<   Return next key press event from the queue, ignoring others.t   KeyPresst   nexti   t   priorit
   KeyReleaseiS   s   getKeypress:%s,%s,%sN(
   R   t   typet   keycodet   key_modifiersR    R   t   keynameR   R   t   False(   Rx   R   (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyt   getkeypress  s     
, c         C   s   t    } t d  } x |  i |  i t |  d t |   } | os | i d j oc | i d j oS | i i i	 oC t
 | i i i  } t |  d j o | i i i i } n | Sq d S(   s   Get next character from queue.i    i   N(   R>   R-   RO   Rc   Re   Ru   R?   R@   R9   R$   t   keysymR(   R   R*   R   (   Rx   R   R   R   t   sym(    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyt   getchar  s    	''c         C   sb   t    } t d  } |  i |  i t |  d t |   } | o | d j o t |  |  Sd S(   s   Check event queue.i    i   N(   R>   R-   RN   Rc   Re   R   (   Rx   R   R   R   (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyt   peek  s
    	'c         C   sS   | o |  i  |  n8 t d  } |  i | d  } | d j o | i |  Sd S(   s   Set/get title.i   i    N(   RW   t   create_unicode_bufferRK   Ru   (   Rx   t   txtt   bufferR   (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyt   title  s    c         C   s   t    } |  i |  i t |   } | p d S| d j	 o | d j	 ou | i i | i i d } | i i | i i	 d } t
 | |  } t
 | |  } |  i |  i |  i | |   n | i i | i i f Sd S(   s   Set/get window size.i   N(   R   RJ   R`   Re   R_   R   R   R   R   R   t   maxRU   R   R   R
   R   (   Rx   t   widtht   heightRz   R   t   wmint   hmin(    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyR     s    	#c         C   sz   t    } |  i |  i t |   oQ | d j	 o | | _ n | d j	 o | | _ n |  i |  i t |   n d S(   s   Set cursor on or off.N(   RA   RH   R`   Re   R_   RB   R   RR   (   Rx   t   visibleR   Rz   (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyt   cursor.  s    	c         C   s   |  i  d  d  S(   Ns   (   R   (   Rx   (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyt   bell8  s    c         C   s   |  i  d 7_  |  i  S(   s   Get next event serial number.i   (   Rm   (   Rx   (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyt   next_serial;  s    Ni   i   i   i   i   i   i   i   i
   i   i   i	   i   i   i   i   i   i   i   (%   R   R   t   __doc__R}   R~   R   R   R_   R   R   t   ret   compileR   R   Rk   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   (    (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyR[      sb   ,					

9			
						

	(   R@   R   c           B   s   e  Z d  Z d   Z RS(   s"   Represent events from the console.c         C   s(  d |  _  | i   |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _ d |  _	 d |  _ d |  _ | i t j o | i i i o d |  _  n
 d |  _  | i i i i |  _ | i i i |  _ | i i i |  _ t |  i |  i |  i  |  _ n+| i t j oj | i i i t @o d |  _  n
 d |  _  | i i i i |  _ | i i i i |  _ | i i i |  _ n | i t j o7 d |  _  | i i  i! i |  _ | i i  i! i |  _ nj | i t" j o* | i i# i$ o d	 |  _  q$d
 |  _  n0 | i t% j o d |  _  | i i& i' |  _ n d S(   s5   Initialize an event from the Windows input structure.s   ??i    t    R   R   t   Motiont   Buttont	   Configuret   FocusInt   FocusOutt   MenuN((   R   R   Rm   R   R   R   R   t   charR   R   R_   R   R?   t	   KEY_EVENTR@   R9   R$   R*   R   R(   R+   t   stateR   t   MOUSE_EVENTR:   R1   t   MOUSE_MOVEDR/   R
   R   R0   t   WINDOW_BUFFER_SIZE_EVENTR;   R   t   FOCUS_EVENTR=   R7   t
   MENU_EVENTR<   R4   (   Rx   t   consolet   input(    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyR}   M  sJ    											"			(   R   R   R   R}   (    (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyR   K  s   c         C   s   t  |   } | S(   s   Get a console handle.

        If buffer is non-zero, a new console buffer is allocated and
        installed.  Otherwise, this returns a handle to the current
        console buffer(   R[   (   R   t   c(    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyt
   getconsolez  s    c         C   s   y; t  t |   } | o t | t  o t d  n WnO t j
 o d St j
 o d } n% t i d IJt	 i
   d } n Xt |  } t i | d  } t i i | | | d  | S(   s7   Wrap a Python readline so it behaves like GNU readline.s   readline must return a string.i    R   s   Readline internal errors   
i   (   R   t   readline_hookt
   isinstancet   strt	   TypeErrort   KeyboardInterruptt   EOFErrorRo   t   stderrt	   tracebackt	   print_excR   R[   R\   t   cdllt   msvcrtt   strncpy(   t   stdint   stdoutt   promptR   R   t   p(    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyt   hook_wrapper_23  s     


c         C   s   y; t  t |    } | o t | t  o t d  n WnO t j
 o d St j
 o d } n% t i d IJt	 i
   d } n Xt i i |  } | S(   s7   Wrap a Python readline so it behaves like GNU readline.s   readline must return a string.i    R   s   Readline internal errors   
(   R   R   R   R   R   R   R   Ro   R   R   R   R   R   t   _strdup(   R  R   R  (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyt   hook_wrapper  s    


c         C   su   |  a  t i t i t i d   } t i d j  o t t	  a
 n t t  a
 t i t t
   i } | | _ d S(   sI   Set up things for the interpreter to call our function like GNU readline.t   PyOS_ReadlineFunctionPointers   2.3N(   R   R-   Rr   R[   RL   Ro   t	   dllhandleRp   t
   HOOKFUNC22R  t   readline_reft
   HOOKFUNC23R  Rs   Ru   (   t   hookt   PyOS_RFPt
   func_start(    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyt   install_readline  s    t   __main__c         C   s   t  t t |    d @ S(   Ni   (   t   chrt	   VkKeyScanR   (   R   (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyR    s    t   dt   Di   i
   s   hi theres   some printed output(b   R   Ro   R   R   t   pyreadline.loggerR    R   t   pyreadline.unicode_helperR   R   t   unicode_helpert   ctypest   _ctypesR   t   ImportErrort   pyreadline.keysymsR   t   pyreadline.console.ansiR   R   Rb   Ra   t   ENABLE_WINDOW_INPUTt   ENABLE_MOUSE_INPUTt   ENABLE_PROCESSED_INPUTt   WHITEt   BLACKR   R   R   R   R   R   t   VK_SHIFTt
   VK_CONTROLt   VK_MENUR   R]   R^   t	   StructureR	   R   R   t   UnionR   R    R#   R.   R2   R3   R6   R8   R>   RA   t   funcsR   t   objectR[   t   funcRw   t   getattrt   windllt   kernel32t	   c_wchar_pRW   t   argtypesR   RK   R   R@   t   user32t
   VkKeyScanAR  R   t	   CFUNCTYPEt   c_char_pR  t   c_void_pR  R_   R   R  R  R  R  R   t   timeR  R   R  R   R   R   R   R   t   iR   t   q(    (    (    sJ   P:\graphics\Tools\python26\lib\site-packages\pyreadline\console\console.pyt   <module>   s   

		

   /						
 	