Ñò
XÁÅGc           @   sY   d  d k  l Z d  d k  Z  d  d k l Z l Z d  d k l Z d d d „  ƒ  YZ d S(   iÿÿÿÿ(   t
   namespacesN(   t   remove_duplicated_linest   left_equals(   t	   SmartFilet   SingleCodeUnitc           B   sP   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z e	 d „ Z
 RS(   s`  
    Represents a cpp file, where other objects can write in one of the     
    predefined sections.
    The avaiable sections are:
        pchinclude - The pre-compiled header area
        include - The include area of the cpp file
        declaration - The part before the module definition
        module - Inside the BOOST_PYTHON_MODULE macro
    c         C   sm   | |  _  | |  _ h  |  _ d |  i d <d |  i d <d |  i d <d |  i d <d |  i d <d | |  _ d  S(   Nt    t
   pchincludet   includet   declarations   declaration-outsidet   modules   BOOST_PYTHON_MODULE(%s)(   t
   modulenamet   filenamet   codet   module_definition(   t   selfR
   R   (    (    s4   /usr/lib/pymodules/python2.6/Pyste/SingleCodeUnit.pyt   __init__   s    			c         C   s8   | |  i  j o t d | ‚ n |  i  | c | 7<d S(   s4   write the given code in the section of the code units   Invalid CodeUnit section: %sN(   R   t   RuntimeError(   R   t   sectionR   (    (    s4   /usr/lib/pymodules/python2.6/Pyste/SingleCodeUnit.pyt   Write-   s    c         C   s4   x- d D]% } |  i  | | i  | |  i  | <q Wd  S(   NR   R   s   declaration-outsideR	   (   s   includes   declarations   declaration-outsides   module(   R   (   R   t   otherR   (    (    s4   /usr/lib/pymodules/python2.6/Pyste/SingleCodeUnit.pyt   Merge4   s     c         C   s   |  i  | S(   N(   R   (   R   R   (    (    s4   /usr/lib/pymodules/python2.6/Pyste/SingleCodeUnit.pyt   Section9   s    c         G   s   d  S(   N(    (   R   t   args(    (    s4   /usr/lib/pymodules/python2.6/Pyste/SingleCodeUnit.pyt
   SetCurrent=   s    c         C   s   d  S(   N(    (   R   (    (    s4   /usr/lib/pymodules/python2.6/Pyste/SingleCodeUnit.pyt   CurrentA   s    c   	      C   st  d } | p
 d } n d } t  |  i | ƒ } | i d ƒ |  i d oV | i t d ƒ ƒ | i |  i d d ƒ | i d ƒ | i d ƒ | i d	 ƒ n. | i t d
 ƒ ƒ | i d ƒ | i d ƒ | i d ƒ |  i d oD | i t d ƒ ƒ t |  i d ƒ } | i | ƒ | i | ƒ n t i o, | o$ | i t d ƒ ƒ | i d ƒ n |  i d } |  i d } | p | o‡ | i t d ƒ ƒ | o | i | d ƒ n | oM t i	 d  } | i d | ƒ | i | ƒ | i d | ƒ | i | ƒ qn | i t d ƒ ƒ | i |  i
 d ƒ | i d ƒ | i |  i d ƒ | i d ƒ | i ƒ  d S(   s%   Writes this code unit to the filenames   

t   wt   as   
R   t   PCHs   #ifdef _MSC_VER
s   #pragma hdrstop
s   #endif
s   Boost Includess   #include <boost/python.hpp>
s   #include <boost/cstdint.hpp>
R   t   Includest   Usings    using namespace boost::python;

R   s   declaration-outsidet   Declarationsiþÿÿÿs   namespace %s {

s   
}// namespace %s
t   Modules   {
R	   s   }

N(   R   R   t   writeR   R   R   t   settingst   USING_BOOST_NSR    t   pysteR   t   close(	   R   t   appendt   spacet   flagt   foutt   includesR   t   declaration_outsidet   pyste_namespace(    (    s4   /usr/lib/pymodules/python2.6/Pyste/SingleCodeUnit.pyt   SaveE   sT    
(   t   __name__t
   __module__t   __doc__R   R   R   R   R   R   t   FalseR,   (    (    (    s4   /usr/lib/pymodules/python2.6/Pyste/SingleCodeUnit.pyR      s   							(    (   R!   R    t   utilsR   R   R   R   (    (    (    s4   /usr/lib/pymodules/python2.6/Pyste/SingleCodeUnit.pyt   <module>   s   