
26ic           @  s   d  d l  m Z d  d l Z d  d l Z d  d l Z d  d l Z e d i   Z d a	 d a
 d   Z d   Z d e f d     YZ d	 e j j f d
     YZ d e f d     YZ d e j j f d     YZ d   Z d S(   i(   t   print_functionNt   asti    c           C  sU   t  d 7a  t  d k r d  Sd a  t j   t k rQ t j   d a t d   n  d  S(   Ni   i  i    i<   s   Possible infinite loop.(   t   il_statementst   timet   il_timet	   Exception(    (    (    s^   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\execution.pyt   check_infinite_loop*   s    
c         C  s   t  j    |  a d S(   sW   
    :doc: other

    Resets the infinite loop detection timer to `delay` seconds.
    N(   R   R   (   t   delay(    (    s^   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\execution.pyt   not_infinite_loop=   s    t   Deletec           B  s   e  Z RS(    (   t   __name__t
   __module__(    (    (    s^   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\execution.pyR	   H   s   t   PredictInfoc           B  s   e  Z d  Z RS(   sC   
    Not used anymore, but needed for backwards compatibility.
    (   R
   R   t   __doc__(    (    (    s^   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\execution.pyR   L   s   t   LineLogEntryc           B  s   e  Z d    Z d   Z RS(   c         C  sI   | |  _  | |  _ | |  _ | |  _ x t j j D] } | |   q1 Wd  S(   N(   t   filenamet   linet   nodet   abnormalt   renpyt   configt   line_log_callbacks(   t   selfR   R   R   R   t   i(    (    s^   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\execution.pyt   __init__T   s    				c         C  sG   t  | t  s t S|  j | j k oF |  j | j k oF |  j | j k S(   N(   t
   isinstanceR   t   FalseR   R   R   (   R   t   other(    (    s^   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\execution.pyt   __eq__]   s    (   R
   R   R   R   (    (    (    s^   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\execution.pyR   R   s   		t   Contextc           B  s  e  Z d  Z d Z d g Z d Z e Z d   Z	 d e d  Z
 e d  Z d   Z d   Z d   Z d	   Z d
   Z d   Z d d  Z d   Z d d  Z d   Z e d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   s  
    This is the context object which stores the current context
    of the game interpreter.

    @ivar current: The name of the node that is currently being
    executed.

    @ivar return_stack: A list of names of nodes that should be
    returned to when the return statement executes. (When a return
    occurs, the name is looked up, and name.text is then executed.)

    @ivar scene_lists: The scene lists associated with the current
    context.

    @ivar rollback: True if this context participates in rollbacks.

    @ivar runtime: The time spent in this context, in milliseconds.

    @ivar info: An object that is made available to user code. This object
    does participates in rollback.
    i   t	   next_nodec         C  s~  | d k  r! |  j  j |  j _ n  | d k  rB t |  _ t |  _ n  | d k  rZ i  |  _ n  | d k  rr t |  _ n  | d k  r t	 j
 j d g  |  _ t |  _ n  | d k  r |  j  j |  _ n  | d k  r t |  _ d  |  _ n  | d	 k  r d  |  _ n  | d
 k  rd  |  _ d  |  _ n  | d k  r2d  |  _ n  | d k  rJd  |  _ n  | d k  rbd  |  _ n  | d k  rzg  |  _ n  d  S(   Ni   i   i   i   i   t   starti   i   i   i	   i
   i   i   i   (   t   predict_infot   imagest   scene_listst   image_predict_infoR   R   t   last_abnormalt   musict   interactingR   t   pythont   RevertableListt   modest   Truet	   use_modest
   init_phaset   NoneR   t   defer_rollbackt   translate_languaget   translate_identifiert   exception_handlert   say_attributest   translate_block_languaget   line_log(   R   t   version(    (    s^   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\execution.pyt   after_upgrade   s<    			c         C  s3  t  t |   j   d
 |  _ g  |  _ g  |  _ i  g |  _ | |  _ d |  _	 t
 j j   |  _ t |  _ t |  _ t |  _ t
 j j   |  _ t |  _ t |  _ d
 |  _ d
 |  _ d
 |  _ g  |  _ t |  _ | rU| j } | j	 |  _	 t |  j  j t | j   x0 | j j   D] \ } } | j    |  j | <qWt
 j! j" j# | j$  |  _$ n d
 } t
 j! j" j# d
  |  _$ t
 j! j% j& | |  j$  |  _ |  j' d d d d d d g  |  j j( i   | rx* t
 j) j* D] } |  j j+ d |  qWn  t
 j j, d	 g  |  _- t |  _. d
 |  _/ d
 |  _0 d
 |  _1 d
 S(   s[   
        `clear`
            True if we should clear out the context_clear_layers.
        i    t   _returnt   _argst   _kwargst   mouse_visiblet   suppress_overlayt   _side_image_attributest   layerR   N(2   t   superR   R   R-   t   currentt   call_location_stackt   return_stackt   dynamic_stackt   rollbackt   runtimeR   R'   t   RevertableObjectt   infoR   t   seenR*   R   R$   t   RevertableDictR%   R&   R,   R.   R1   R2   R4   t   force_checkpointR"   t   varst   updatet	   iteritemst   copyt   displayt   imaget   ShownImageInfoR!   t   coret
   SceneListst   make_dynamict   appendR   t   context_clear_layerst   clearR(   R)   R+   R/   R0   R3   (   R   RC   t   contextRV   t   oldslt   kt   vR   (    (    s^   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\execution.pyR      sN    																			c         C  s   t  j j } | r d } n d } x_ | D]W } | |  j | k rG q( n  | | k rk | | |  j | | <q( t   |  j | | <q( Wd S(   s   
        Makes the variable names listed in names dynamic, by backing up
        their current value (if not already dynamic in the current call).
        i    iN(   R   t   storet   __dict__RB   R	   (   R   t   namesRW   R[   t   indexR   (    (    s^   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\execution.pyRS     s    	c         C  sl   |  j  s d St j j } |  j  j   } x= | j   D]/ \ } } t | t  rZ | | =q5 | | | <q5 Wd S(   sg   
        Pops one level of the dynamic stack. Called when the return
        statement is run.
        N(   RB   R   R[   R\   t   popRL   R   R	   (   R   R[   t   dynamicRY   RZ   (    (    s^   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\execution.pyt   pop_dynamic*  s    	
c         C  s   x |  j  r |  j   q Wd S(   se   
        Pops all levels of the dynamic stack. Called when we jump
        out of a context.
        N(   RB   Ra   (   R   (    (    s^   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\execution.pyt   pop_all_dynamic=  s    c         C  s   | |  _  d S(   se   
        Sets the name of the node that will be run when this context
        next executes.
        N(   R?   (   R   t	   node_name(    (    s^   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\execution.pyt
   goto_labelF  s    c         C  s   t  |  j  t  |  j  d k r t d j t  |  j  t  |  j    } x6 t  |  j  t  |  j  d k  r |  j j i   qO Wx0 t  |  j  t  |  j  d k r |  j   q W|  n  d S(   s1   
        Check and fix stack corruption.
        i   s7   Potential return stack corruption: dynamic={} return={}N(   t   lenRB   RA   R   t   formatRT   Ra   (   R   t   e(    (    s^   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\execution.pyt   check_stacksN  s    "*%%c         C  s   | r
 d  Sg  } xt |  j  D]i } yY t j j j |  } | j j d d  j d  sx | j | j | j	 d d  f  n  Wq q Xq Wy\ t j j j |  j  } | j j d d  j d  s | j | j | j	 d d  f  n  Wn n X| S(   Ns   \t   /s   common/s   script callt   script(   R@   R   t   gameRj   t   lookupR   t   replacet
   startswithRT   t
   linenumberR-   R?   (   R   t   namet   lastt   rvR   R   (    (    s^   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\execution.pyt   report_traceback_  s"    &&c         B  s`   e  j d | j d d  } e  j d | j d d d | g  } e | | j d  } | d Ud S(   s   
        Execs a python pass statement on the line of code corresponding to
        `node`. This indicates to python coverage tools that this line has
        been executed.
        t   linenot
   col_offseti    t   bodyt   execN(   t   pyastt   PassRo   t   Modulet   compileR   (   R   R   t   pst   modulet   code(    (    s^   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\execution.pyt   report_coveragew  s    $c         C  s  d	 |  _ t |  _ | d	 k r9 t j j j |  j  } n  t j	 j
 } t j   d	 k	 } x}| r| j |  _ |  j |  _ t |  _ d	 |  _ t j	 j r t | j | j | |  j  } | |  j k r |  j j |  q n  |  j rt j j rt j j j   n  |  j r,t j j j d t  t |  _ n  t |  _ t j j j |  j  yoy\ t   | rn|  j  |  n  d t j _! d	 |  _" | j#   | r|  j" r|  j$   n  Wnt j j% k
 r} d	 |  _&   n t' k
 r} d	 |  _& t j(   } t j) j* | d t \ } } }	 yJ |  j d	 k	 r>|  j | | |	  n! t j+ j) j* | | |	  r_  n  Wqt j j% k
 r}
 |
  qt' k
 r}
 | d | d | d  qXn X|  j" } Wn t j j, k
 r} t j j j | j- d  } t |  _ n| t j j. k
 ru} |  j" d	 k r-t' d   n  |  j/ | j0 d |  j" j } t |  _ | j- t j1 _2 | j3 t j1 _4 n X|  j rt t j j5 j6 |  j <t t j j7 |  j <n  |  j rZ t j j rZ t j j j8   qZ qZ Wd	 S(
   s   
        Executes as many nodes as possible in the current context. If the
        node argument is given, starts executing from that node. Otherwise,
        looks up the node given in self.current, and executes from there.
        t   hards   While running game code:t   editori    i   i   s9   renpy.call can't be used when the next node is undefined.t   return_siteN(9   R-   R1   R*   R   R   Rk   Rj   Rl   R?   R   t	   developert   syst   gettraceRp   R$   R   R.   R4   R   R   Ro   RT   RC   t   logt   beginRI   t
   checkpointRG   t   testt   testexecutiont	   take_nameR   R   t   exception_infoR   t   executeRh   t   CONTROL_EXCEPTIONSt   translate_interactionR   t   exc_infot   errort   report_exceptionRN   t   JumpExceptiont   argst   CallExceptiont   callt   labelR[   R8   t   kwargsR9   t
   persistentt
   _seen_evert   seen_sessiont   complete(   R   R   R   t   tracingt   ll_entryRg   R   t   shortt   fullt   traceback_fnt   ce(    (    s^   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\execution.pyt   run  s    								
		!
	 		c         C  s   t  |  _ d S(   sT   
        Marks the current statement as one that has been seen by the user.
        N(   R*   RG   (   R   (    (    s^   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\execution.pyt	   mark_seen  s    c         C  s   |  j  s t d   n  | d k r0 |  j  } n  |  j j |  j   |  j j |  |  j j i   | |  _  |  j d d g  d t j	 _
 d t j	 _ t j j j |  S(   s(   
        Calls the named label.
        s-   Context not capable of executing Ren'Py code.R8   R9   N(   R?   R   R-   R@   RT   RA   RB   RS   R   R[   R8   R9   Rk   Rj   Rl   (   R   R   R   (    (    s^   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\execution.pyR     s    		c         C  sP   |  j  s( t j j r$ t d   n  d S|  j  j   |  j j   |  j   d S(   sB   
        Blindly pops the top call record from the stack.
        s   No call on call stack.N(   RA   R   R   R   R   R_   R@   Ra   (   R   (    (    s^   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\execution.pyt   pop_call  s    	c         C  s  x|  j  rd } t j j j |  j  d  rM t j j j |  j  d  } n> t j j j |  j d  r t j j j |  j d  j } n  | d k r t j	 j
 r t d j |  j  d    n  |  j  j   |  j j   |  j   q n  | r|  j  j   |  j j   n  | SWd S(   sZ   
        Returns the node to return to, or None if there is no
        such node.
        is!   Could not find return label {!r}.N(   RA   R-   R   Rk   Rj   t	   has_labelRl   R@   t   nextR   R   R   Rf   R_   Ra   (   R   R_   R   (    (    s^   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\execution.pyt   lookup_return  s$    "
c         C  s   t  |  j |   } |  j | _ |  j | _ g  |  j D] } | j   ^ q6 | _ |  j | _ |  j | _ |  j | _ |  j	 | _	 |  j
 | _
 | S(   sL   
        Makes a copy of this object, suitable for rolling back to.
        (   R   RC   R@   RA   RB   RM   R?   RD   RF   R/   R0   (   R   Rr   R   (    (    s^   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\execution.pyt   rollback_copy8  s    %c         C  s5   t  |  j  |  _ |  j j |  t j j j |  S(   s  
        This is called by the prediction code to indicate that a call to
        `label` will occur.

        `return_site`
            The name of the return site to push on the predicted return
            stack.

        Returns the node corresponding to `label`
        (   t   listt   predict_return_stackRT   R   Rk   Rj   Rl   (   R   R   R   (    (    s^   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\execution.pyt   predict_callK  s    c         C  sA   |  j  s d St |  j   |  _  |  j  j   } t j j j |  S(   sv   
        This predicts that a return will occur.

        It returns the node we predict will be returned to.
        N(   R   R-   R   R_   R   Rk   Rj   Rl   (   R   R   (    (    s^   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\execution.pyt   predict_return\  s
    	c         c  s  |  j  s d St j j d k r# d S|  j } g  } t   } x t j j |  j   D]o } t j j j	 |  sp d St j j j
 |  } | | k r qQ n  | j | |  j |  j f  | j |  qQ Wx#t d t j j  D]} | t |  k r Pn  | | \ } } } t j j j |  |  _ | |  _ ye x^ | j   D]P }	 |	 d k rRq:n  |	 | k r:| j |	 |  j |  j f  | j |	  q:q:WWn= t j j rd d l }
 t   |
 j   t d  qn X| |  _ d |  _ t Vq Wt Vd S(   s   
        Performs image prediction, calling the given callback with each
        images that we predict to be loaded, in the rough order that
        they will be potentially loaded.
        Ni    is   While predicting images.(   R?   R   R   t   predict_statements_callbackR-   R!   t   setRk   Rj   R   Rl   RT   RA   t   addt   ranget   predict_statementsRe   RN   RO   RP   R   t   predictt   debug_image_cachet	   tracebackt   printt	   print_excR*   R   (   R   t
   old_imagest   nodesRG   R   R   R   R!   RA   t   nR   (    (    s^   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\execution.pyR   k  sL    				
			c         C  s>   |  j  s t S| r% t j j j } n t j j } |  j  | k S(   s2  
        Returns a true value if we have finshed the current statement
        at least once before.

        @param ever: If True, we're checking to see if we've ever
        finished this statement. If False, we're checking to see if
        we've finished this statement in the current session.
        (   R?   R   R   Rk   R   R   R   (   R   t   everRG   (    (    s^   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\execution.pyt   seen_current  s    
	c         C  s<   |  j  s d S|  j  \ } } d |  _  t j j | |  d S(   s=   
        Called to cause deferred rollback to occur.
        N(   R.   R-   R   t   exportsRC   (   R   t   forcet   checkpoints(    (    s^   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\execution.pyt   do_deferred_rollback  s
    		c         C  s   t  |  j  S(   N(   R   RA   (   R   (    (    s^   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\execution.pyt   get_return_stack  s    c         C  s   t  |  |  _ x_ t |  j  t |  j  k rp |  j j   |  j j   } | j |  j d  | |  j d <q WxB t |  j  t |  j  k  r |  j j d  |  j j i   qt Wd  S(   Nis   unknown location(   R   RA   Re   R@   R_   RB   RK   RT   (   R   RA   t   d(    (    s^   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\execution.pyt   set_return_stack  s    !!N(    R
   R   R   t   __version__t   nosaveR-   R   R   RI   R6   R   RS   Ra   Rb   Rd   Rh   Rs   R   R   R   R   R   R*   R   R   R   R   R   R   R   R   R   (    (    (    s^   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\execution.pyR   d   s6   		,d							f		"				H			c         C  s"  d } xt ryh t j j   } | rL t j j j |  rL | j |  n  d } | j   t j	 j
 } | j   | SWq	 t j j k
 r } t j j t  | j r	 | j } q	 q	 q	 t j j k
 r} |  r t j j t  | j r	 | j } q	 q	 q  q	 | j     q	 Xq	 Wd S(   s   
    Runs the current context until it can't be run anymore, while handling
    the RestartContext and RestartTopContext exceptions.
    N(   R-   R*   R   Rk   RW   Rj   R   R   R   R[   R7   Rb   t   RestartContextR   t   execute_default_statementR   R   t   RestartTopContext(   t   topR   RW   Rr   Rg   (    (    s^   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\execution.pyt   run_context  s4    	

		
(   t
   __future__R    R   R   t   renpy.displayR   t
   renpy.testt
   __import__Rx   R   R   R   R   t   objectR	   t   ObjectR   R   R   R   (    (    (    s^   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\execution.pyt   <module>   s    		  