
XGc           @   s   d  d k  Z  d  d k l Z d  d k Td  d k Td  d k Td  d k l Z d  d k l Z d  d k l Z l	 Z	 d  d k
 Z
 d  d k Z d  d k Z d e f d     YZ e d	  Z d
 e f d     YZ d S(   iN(   t   Exporter(   t   *(   t   SingleCodeUnit(   t   EnumExporter(   t   makeidt	   enumeratet   ClassExporterc           B   s  e  Z d  Z d' 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 d   Z d   Z d i   Z e e e e e e     Z h d d 6Z h d e i d  6d e i d  6d e i d  6d e i d  6d e i d  6d e i d   6Z  d!   Z! d"   Z" d#   Z# d$   Z$ d%   Z% d&   Z& RS((   s9   Generates boost.python code to export a class declarationc         C   s   t  i |  | |  h  |  _ g  |  i d <g  |  i d <g  |  i d <g  |  i d <g  |  i d <g  |  i d <g  |  i d <g  |  _ g  |  _ d  S(   Nt   templatet   constructort   insidet   scopet   declarations   declaration-outsidet   include(   R    t   __init__t   sectionst   constructorst   nested_codeunits(   t   selft   infot   parser_tail(    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyR      s    		c         C   s   t  |  i i    d S(   Nt   _scope(   R   t   class_t   FullName(   R   (    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyt	   ScopeName3   s    c         C   s
   |  i  i S(   N(   R   t   name(   R   (    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyt   Name7   s    c         C   s   t  i |  |  |  i o |  i |  i i  } t | t  o< |  i | i i  |  _	 |  i i
 p | i |  i _
 q n
 | |  _	 t i |  i	  |  _	 n
 d  |  _	 d  S(   N(   R    t   SetDeclarationst   declarationst   GetDeclarationR   R   t
   isinstancet   Typedeft   typeR   t   renamet   copyt   deepcopyt   None(   R   R   t   decl(    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyR   ;   s    
	c         C   sf   g  } x2 |  i  i D]$ } x | D] } | i |  q  Wq Wg  } | D] } | |  i | i  qF ~ S(   N(   R   t	   hierarchyt   appendR   R   (   R   t	   all_basest   levelt   baset   _[1]t   x(    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyt
   ClassBasesJ   s      c         C   s%   t  |  i    } | |  i i   f S(   s   Return the TOTAL number of bases that this class has, including the
        bases' bases.  Do this because base classes must be instantialized
        before the derived classes in the module definition.  
        (   t   lenR,   R   R   (   R   t	   num_bases(    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyt   OrderR   s    c         C   s   |  i  |  |  i   |  i i p |  i   |  i |  |  i   |  i   |  i |  |  i	   |  i
   |  i |  |  i |  |  i   |  i   |  i   |  i |  d | |  i   <n d  S(   Ni   (   t   InheritMethodst   MakeNonVirtualR   t   excludet   ExportBasicst   ExportBasest   ExportConstructorst   ExportVariablest   ExportVirtualMethodst   ExportMethodst   ExportOperatorst   ExportNestedClassest   ExportNestedEnumst   ExportSmartPointert   ExportOpaquePointerPoliciest   ExportAddedCodet   WriteR   (   R   t   codeunitt   exported_names(    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyt   Export[   s"    








c            sI  t  t t t f   g  } |  i D] } | | i   q  ~ } g  } |  i D]* } t | t   o | | i t  qJ qJ ~ } t	 g  } | D] } | | d f q ~  } t	 g  } | D] } | | d f q ~  } x$|  i i D]}	 t }
 x |	 D] } |  i | i  } | i   | j o x | D] } t |    j o t i |  } |  i i   | _ t | t   o> | i t  } | | j o |  i i |  d | | <qq| i   | j o |  i i |  qq)q)Wq t }
 q W|
 o Pq q W  f d   } g  } |  i D] } | |  o | | qq~ |  _ d S(   sA  Go up in the class hierarchy looking for classes that were not
        exported yet, and then add their public members to this classes
        members, as if they were members of this class. This allows the user to
        just export one type and automatically get all the members from the
        base classes.
        c            s    t  |     o |  i t i j S(   N(   R   t
   visibilityt   Scopet   public(   t   member(   t   valid_members(    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyt   IsValid   s    N(   t   Methodt   ClassVariablet   NestedClasst   ClassEnumerationR   R   R   t   PointerDeclarationt   Truet   dictR#   R%   t   FalseR   R   R   R!   R"   t	   AddMembert   public_members(   R   RA   R*   R+   t	   fullnamest   _[2]t   pointerst   _[3]t   _[4]R(   t   level_exportedR)   RF   t   member_copyt   pointerRH   t   _[5](    (   RG   s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyR0   o   s:    *A--    
	c         C   s{  |  i  } t i } t i } d } |  i } |  i d p | } | o, |  i   } | | | d | | f 7} n d i |  i d  }	 | | | d |	 7} d i |  i d  }
 | d |
 7} | d	 } x' |  i d
 D] } | | | d 7} q W| p | | d 7} ns | | d 7} x' |  i d D] } | | | d 7} q*Wx% | D] } | d | i d  7} qMW| | d | 7} | i	 d | d  d i |  i d  } x! | D] } | | i d  7} qW| o | i	 d | d  n d i |  i d  } | o | i	 d | d  n d i |  i d  } x! | D] } | | i d  7} q?W| o | i	 d |  n d  S(   Nt    R
   s   scope* %s = new %sscope(
s   , R   s   class_< %s >R   s   (%s)
i   R	   s   
s   ;
s   );
t   modules   delete %s;
R   s   declaration-outsideR   (
   t   INDENTt
   namespacest   pythont   pysteR   R   R   t   joint   SectionR?   (   R   R@   t   indentt   boost_nst   pyste_nst   codeR   t   needs_scopet
   scope_namet   template_paramst   constructor_paramst	   in_indentt   linet   nested_unitR   t   declarations_outsidet   includes(    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyR?      sX    				
     c         C   s   |  i  | i |  d S(   s+   Add the item into the corresponding sectionN(   R   R&   (   R   t   sectiont   item(    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyt   Add   s    c         C   sP   |  i  i   } |  i d |  |  i i p
 |  i  i } |  i d d |  d S(   s6   Export the name of the class and its class_ statement.R   R   s   "%s"N(   R   R   Rs   R   R    R   (   R   t
   class_nameR   (    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyR3      s    c         C   s   |  i  i } g  } xb | D]Z } xE | D]= } | i t i j o$ | i | j o | i | i  q& q& W| o Pq q W| o. t i d d i	 |  } |  i
 d |  n d S(   s7   Expose the bases of the class into the template sections   bases< %s > s   , R   N(   R   R%   RC   RD   RE   R   R&   R_   R`   Rb   Rs   (   R   RA   R%   t   exportedR(   R)   Rg   (    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyR4      s      #	c   	         s  t  i   |  i }   f d   } g  } |  i D]! } t | t  o | | q/ q/ ~ } | |  _ |  i i o4 x1 | D]% } | i	   o | i
 |  Pqw qw Wn | p |  i d   d  n d } xD | D]< } | d j p t | i  t | i  j  o
 | } q q W| d j	 p t  |  i d | |   | i
 |  x. | D]& } d | |  } |  i d |  qNW|  i i   p |  i i o |  i d t  i d  n d S(	   sn   Exports all the public contructors of the class, plus indicates if the 
        class is noncopyable.
        c   	         s   g  } |  i  D] } | | i   q ~ } | |  i  } | |  i } d i |  } d i |  }   d } | | 7} | o+ | o | d 7} n |   d | 7} n | d 7} | S(   s1   return the init<>() code for the given contructors   , s   init< s   optional< %s >s    >()(   t
   parametersR   t   minArgsRb   (	   t   consR*   t   pt
   param_listt   min_params_listt   max_params_listt
   min_paramst
   max_paramst   init(   t   py_ns(    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyt	   init_code   s    *


R   t   no_inits   .def(%s)R	   R   t   noncopyableN(   R_   R`   R^   RR   R   t   ConstructorR   R   t   abstractt   IsCopyt   removeRs   R#   R-   Rv   t   AssertionErrort   HasCopyConstructort   boost(	   R   Rd   R   R*   R+   R   Rx   t   smallerRg   (    (   R   s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyR5      s6    		8
  , c   	      C   s   g  } |  i  D]! } t | t  o | | q q ~ } x | D] } |  i | i i o q? n |  i | i i p | i } | i   } | i i	 o
 d } n d } d | | | f } |  i
 d |  q? Wd S(   sC   Export the variables of the class, both static and simple variabless   .def_readonlys   .def_readwrites   %s("%s", &%s)R	   N(   RR   R   t   VariableR   R   R2   R    R   R   t   constRs   (	   R   R*   R+   t   varst   varR   t   fullnamet   def_Rg   (    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyR6   !  s    8 
c         C   s0   t  | i    } d | i | i f } | | S(   s=   Returns the name of the overloads struct for the given methods   _overloads_%i_%i(   R   R   Rw   t   maxArgs(   R   t   methodR   t	   overloads(    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyt   OverloadName1  s    c         C   sd   |  i  i } g  } | oG xD | D]8 \ } } |  i |  } | |  i  | _ | i |  q  Wn | S(   N(   R   t	   __added__R   R    R&   (   R   t   added_methodst   resultR   R    R$   (    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyt   GetAddedMethods8  s     c      
      s5  h       f d   }  f d   } d   } g  }  i  D] } | |  o | | q> q> ~ } | i  i    h  } x| D]}}  i | i }	 |	 i o q n |	 i p | i }
 t i | |	 i	  |	 _	 |	 i	 p d } | o d t
 i | i   f } n d } | i | i j o; |	 i o0 | |   i |  } d t
 i | f } n | |  } d |
 | f } | | 7} | | 7} | d 7}  i d |  t | t  o | i o d	 | |
 <n |	 i } | o! | i o  i d
 | i  q q Wx( | D]  }
 d |
 }  i d |  qWd S(   sn   Export all the non-virtual methods of this class, plus any function
        that is to be exported as a methodc            s   t  |  t  o
 |  i p t |   t j o |  i   } d } n |  i } d } d |  i |   | |  i |  i	 f } |   j o t
   | < i d |  n d S(   s6   Declares the macro for the generation of the overloadst   BOOST_PYTHON_FUNCTION_OVERLOADSt&   BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADSs   %s(%s, %s, %i, %i)
R   N(   R   RI   t   staticR   t   FunctionR   R   R   Rw   R   RN   Rs   (   t   mt   funct   macroRg   (   t   declaredR   (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyt   DeclareOverloadsH  s    -
	(
c            s7     i  |  i i } | o d | i   S|  i   Sd S(   s8   returns the correct pointer declaration for the method mt   &N(   R   R   t   wrapperR   RM   (   R   R   (   R   (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyt   PointerV  s    c         S   s8   t  t t f } t |  t  o t |  |  o |  i S(   s>   Returns true if the given method is exportable by this routine(   R   t   ClassOperatort
   DestructorR   R   t   virtual(   R   t   ignore(    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyt   IsExportable_  s    R\   s   , %s%s()s   .def("%s", %st   )R	   i   R   s   .staticmethod("%s")N(   RR   t   extendR   R   R   R2   R    t   exporterutilst   HandlePolicyt   policyR_   R`   t   CodeRw   R   R   R   Ra   Rs   R   RI   R   Rg   (   R   R   R   R   R*   R+   t   methodst   staticmethodsR   t   method_infoR   R   t   overloadt   overload_nameRZ   Rg   R   (    (   R   R   s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyR8   C  sJ    		5 




	 
c         C   sP   xI |  i  D]> } t |  t j o% | i o |  i | i i | _ q
 q
 Wd S(   s   Make all methods that the user indicated to no_override no more virtual, delegating their
        export to the ExportMethods routineN(   R   R   RI   R   R   R   t   no_override(   R   RF   (    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyR1     s    
 c         C   s(  t  } x9 |  i D]. } t |  t j o | i o t } Pq q W|  i i } | o t |  i |  i	   |  i |  } | o  |  i
 d | | i     n |  i
 d | i    x$ | i   D] } |  i
 d |  q W|  i
 d | i |  i   n+ | o# |  i
 d | |  i i     n d  S(   NR   R	   R   (   RP   R   R   RI   R   RN   R   t   holdert   _VirtualWrapperGeneratorR,   Rs   R   t   GenerateDefinitionst   GenerateVirtualWrapperR^   (   R   R@   t   has_virtual_methodsRF   R   t	   generatort
   definition(    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyR7     s$    
 	!   sO   + - * / % ^ & ! ~ | < > == != <= >= << >> && || += -= *= /= %= ^= &= |= <<= >>=t   __call__s   ()t	   __float__s   (const)?\s*double$s   (const)?\s*float$t   __int__s   (const)?\s*int$t   __long__s   (const)?\s*long$t   __str__s   (const)?\s*char\s*\*?$s(   (const)?.*::basic_string<.*>\s*(\*|\&)?$c            s[    f d   }   f d   } d   } |   } g  }   i  D]$ } t |  t j o | | q> q> ~ } | | } g  }	 | D]) }   i d | i i p |	 | q q ~	 }
 xy|
 D]q}   i d | i i } | o5 d | i   } | i o   i	 d | i  qn | i
   }   i d | i i } | p | p | i   i j } | |  } | d j	 } | o | p( | o | i } q  i | i } n d }   i d | i i } | o d | i   } n   i	 d	 d
 | | | f  q | o   i	 d	 |  q | i   i j o | } t | t  o t | i  d j p# t | t  o t | i  d j } | o$   i	 d	 d | i t i f  q*t | i  d j o* | | i d  } | | i d  } n! t i d } | | i d  }   i	 d	 d | | i | f  q q Wg  }   i  D]$ } t |  t j o | | q<q<~ }   f d   } x | D] }   i d | i i   } | i o qn | |  } | i p | oj | i p
 | |  } | i
   } d } | i o d | i i   } n   i	 d	 d
 | | | f  q| o   i	 d	 |  qqWd S(   sD   Export all member operators and free operators related to this classc             sq   g  }  xd   i  D]Y } t | t  oC x@ | i D]1 } | i   i i   j o |  i |  Pq0 q0 Wq q W|  S(   s9   Get all the free (global) operators related to this class(   R   R   t   OperatorRv   R   R   R   R&   (   t	   operatorsR$   t   param(   R   (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyt   GetFreeOperators  s    
 
 c            s;   |  i    i i   j o t i d St i d |  i  Sd S(   sG   Returns the operand of this parameter (either "self", or "other<type>")R   s   other< %s >()N(   R   R   R   R_   R`   (   R   (   R   (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyt
   GetOperand  s    c         S   s   |  i  i } d } |  i o |  i d i } n d } | i |  d j o | i |  d j } | o) t i d } t i d } d | | f Sd  S(   NR\   i    t   basic_ostreamis	   self_ns::R   s   .def(%sstr(%s))(   R   R   Rv   t   findR_   R`   R#   (   t   operatort   result_namet   param1_namet   ostreamt   is_strt	   namespacet   self_(    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyt   HandleSpecialOperator  s    
+R   R   s   declaration-outsideR\   s   , %s()R	   s   .def("%s", %s%s)i   i    s   .def( %s%sself )i   R   s   .def( %s %s %s )c            sh   |  i  i   } |  i  i } xF   i i   D]! \ } } | i |  o | Sq+ Wt |  } d | Sd  S(   Nt   to_(   R   R   R   t   SPECIAL_CONVERTERSt   itemst   matchR   (   t	   convertert   result_fullnameR   t   regext   method_name(   R   (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyt   ConverterMethodName9  s     	N(   RR   R   R   R   R   R2   R   R   Rg   Rs   RM   R    t   BOOST_RENAME_OPERATORSR#   R   R   t   BOOST_SUPPORTED_OPERATORSR   R   R-   Rv   R_   R`   t   ConverterOperatorR   (   R   R   R   R   t   freesR*   R+   t   memberst   all_operatorsRT   R   R   R   RZ   R    t   export_as_methodt   special_codet   has_special_representationR   t
   policy_objt   opt   is_unaryt   left_operandt   right_operandRV   t
   convertersR   R   R   R   t   policy_code(    (   R   s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyR9     s|    		;
= 
 !&%; 

!c   	      C   s   g  } |  i  D]! } t | t  o | | q q ~ } x | D] } |  i | i } |  i i | _ | i   | _ |  i |  } | i |  i	  t
 d  d   } | i | |  |  i i |  q? Wd  S(   N(   RR   R   RK   R   R   R   R   t	   __class__R   R   R   R#   RB   R   R&   (	   R   RA   R*   R+   t   nested_classest   nested_classt   nested_infot   exporterR@   (    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyR:   Y  s    8 c   	      C   s   g  } |  i  D]! } t | t  o | | q q ~ } x | D] } |  i | i } |  i i | _ | i   | _ t |  } | i |  i	  t
 d  d   } | i | |  |  i i |  q? Wd  S(   N(   RR   R   RL   R   R   R   R   R   R   R   R   R#   RB   R   R&   (	   R   RA   R*   R+   t   nested_enumst   enumt	   enum_infoR   R@   (    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyR;   f  s    8 c         C   sQ   |  i  i } | o: |  i i   } | | } |  i d d t i | f  n d  S(   NR
   s!   %sregister_ptr_to_python< %s >();(   R   t	   smart_ptrR   R   Rs   R_   R`   (   R   R   Rt   (    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyR<   s  s
    
c         C   s   g  } |  i  D]! } t | t  o | | q q ~ } xh | D]` } t t  } |  i | i i | j o4 t i	 | i
 i  } | o |  i d |  q q? q? Wd  S(   Ns   declaration-outside(   RR   R   RI   t   return_value_policyt   return_opaque_pointerR   R   R   R   t   EspecializeTypeIDR   Rs   (   R   R*   R+   R   R   t   return_opaque_policyR   (    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyR=   {  s    8 c         C   s<   |  i  i o+ x( |  i  i D] } |  i d |  q Wn d  S(   NR	   (   R   t   __code__Rs   (   R   Rg   (    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyR>     s     N('   t   __name__t
   __module__t   __doc__R#   R   R   R   R   R,   R/   RB   R0   R?   Rs   R3   R4   R5   R6   R   R   R8   R1   R7   t   splitR   RO   t   zipt   rangeR-   R   t   ret   compileR   R9   R:   R;   R<   R=   R>   (    (    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyR      sJ   								%	8				9				U		!
					
c         C   s   | d  j o t |  i  } n g  } t |  D] } | d | q1 ~ } g  } |  i |  D] } | | i   q] ~ } g  } t | |  D] \ }	 }
 | d |	 |
 f q ~ } d i |  } | | | f S(   Ns   p%is   %s %ss   , (   R#   R-   Rv   R   R   R   Rb   (   R   t   countR*   t   it   param_namesRT   R+   t   param_typesRV   t   tt   nt   params(    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyt   _ParamsInfo  s    +.:R   c           B   se   e  Z d  Z d   Z d Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z RS(   s?   Generates code to export the virtual methods of the given classc         C   sg   t  i |  |  _ | |  _ | |  _ t | i    d |  _ d  |  _	 h  |  _
 | |  _ |  i   d  S(   Nt   _Wrapper(   R!   R"   R   t   basesR   R   R   t   wrapper_nameR#   t   virtual_methodst   _method_countR@   t   GenerateVirtualMethods(   R   R   R
  R   R@   (    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyR     s    
				t   py_selfc         C   sl   d | i  } | i } | i } | | j o | g Sg  } t | | d  D] } | | d | qL ~ Sd S(   s   Returns a list of default implementations for this method, one for each
        number of default arguments. Always returns at least one name, and return from 
        the one with most arguments to the one with the least.
        t   default_i   s   _%iN(   R   Rw   R   R   (   R   R   t	   base_nameRw   R   R*   R  (    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyt   DefaultImplementationNames  s    		c      	      s  t  i } t  i }   i | i i p | i } | i i   } d  | d j o
 d  n t |  \ } } }	 d }
 | i	 o
 d }
 n  d | | i | |
 | i
   f } d i |  } | o d | } n   i } |  d d t   7} |  d	 7}     f d
   } | i o | i t i j o | i } | i }   i |  } x t | t | | d   D]m \ } } t | |  \ } } }	 | d 7} |  d | | | |
 f 7} | | | |  7} |  d	 7} quWn | S(   s   Returns a string with the declarations of the virtual wrapper and
        its default implementations. This string must be put inside the Wrapper
        body.        
        s   return t   voidR\   s    consts   %s %s(%s)%s%s {
s   , i   sb   %(return_str)s%(python)scall_method< %(result)s >(%(self_str)s, "%(rename)s"%(param_names_str)s);
s   }
c            s     d }  i  |  i i } | p% | d  |  i   d i |  f S| i o  i i d | i  n d i d g |  } | d  | i   | f Sd S(   s3   Return the body of a default implementation wrapperi   s
   %s%s(%s);
s   , s   declaration-outsidet   thisN(   R   R   R   R   Rb   Rg   R@   R?   (   R   R  t   indent2R   R  (   Rd   R   t
   return_str(    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyt   DefaultImpl  s    

i   s   
s   %s %s(%s)%s {
(   R_   Ra   R`   R   R   R    R   R   R  R   t
   ExceptionsRb   t   SELFt   localsR   RC   RD   t   privateRw   R   R  R   R   (   R   R   Rd   Ra   R`   R    R   R  R  R  t   constantnessR$   t   param_names_strt   self_strR  Rw   R   t
   impl_namest	   impl_namet   argNum(    (   R   R  Rd   s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyt   Declaration  s@    		


&			 
c      	   C   s  t  i } |  i | i i p | i } |  i |  } |  i i   } | |  i } | i	 i   } | i
 } d }	 | i o
 d }	 n | i }
 | i } | i o
 g  } n | o/ g  } | D] } | d | | f q ~ } n g  } x t | t |
 | d   D] \ } } g  } | i |  D] } | | i   q ~ } d i |  } d | | | |	 f } d | | | f } | i |  qW| i   } | i o t  i d | } n |  i | i } t i | | i  | _ | i p d } | o d	 t  i | i   f } n g  } | oT | i d
 | | | d | f  xJ | d  D]  } | i d | | | f  qEWn | i d | | | f  | S(   sg   Returns a list of lines, which should be put inside the class_
        statement to export this method.R\   s    consts   &%s::%si   s   , s   %s (%s::*)(%s)%ss   (%s)&%s::%ss   pure_virtual(%s)s   , %s%s()s   .def("%s", %s, %s%s)is   .def("%s", %s%s)(   R_   Ra   R   R   R    R  R   R   R  R   t	   is_uniqueR   Rw   R   R   R   R   Rv   Rb   R&   RM   R`   R   R   R   R   (   R   R   Ra   R    t   default_namesRt   R  R   t   is_method_uniqueR  Rw   R   t   default_pointersR*   R+   R   R!  RT   Rz   R  t	   signaturet   default_pointerRZ   R   R   t   definitions(    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyt   MethodDefinition  sP    		

		

/ .
! "c         C   s   t  i |  i S(   N(   R_   Ra   R  (   R   (    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyR   /  s    c      
   C   sd  d   } d   } h  } g  |  _  xB |  i D]7 } | |  o$ d | | |  <|  i  i |  q+ q+ Wxm |  i D]b } g  } | D]' } | |  o | t i |  q q ~ } x | D] }	 |  i i |	  q Wqp Wg  }
 |  i D] } | |  o |
 | q q ~
 } xR | D]J } | |  } | |  o+ | | j o |  i  i |  d | | <qqWd S(   s  To correctly export all virtual methods, we must also make wrappers
        for the virtual methods of the bases of this class, as if the methods
        were from this class itself.
        This method creates the instance variable self.virtual_methods.
        c         S   sV   t  |   t j o; |  i o |  i } |  i o |  i t i j } | p | St Sd  S(   N(   R   RI   R   R   RC   RD   R  RP   (   R   t   pure_virtualR   (    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyt	   IsVirtual9  s
    c         S   s   |  i  o
 d } n d } |  i o |  i i   } n d } d i g  } |  i D] } | | i   qQ ~  } d | |  i | | |  i   f S(   Ns    constR\   s   , s   %s %s(%s)%s%s(   R   R   R   Rb   Rv   R   R  (   R   R   R   R*   R+   R  (    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyt	   MethodSigE  s    


3i    N(   R  R   R#   R&   R
  R!   R"   RQ   (   R   R,  R-  t   already_addedRF   R)   R*   R+   t   base_methodst   base_methodRT   t   all_methodst   sig(    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyR  3  s,    			
 
 ; 5 c         C   s   |  i  i d t  S(   Nt   publics_only(   R   t   ConstructorsRN   (   R   (    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyR4  g  s    c         C   sf   g  } xY |  i  D]N } |  i | i i } | i t i j o" | o | i |  i |   q q W| S(   N(	   R  R   R   R2   RC   RD   RE   R   R*  (   R   t   defsR   R2   (    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyR   k  s    
 c      	   C   s  |  i  i   } d |  i | f } | d 7} x |  i   D] } | i } | i } d } x t | | d  D] } t | |  \ }	 }
 } |	 o d |	 }	 n | | d |  i |  i |	 f 7} | | d d | d i	 |
  |  i |  i f 7} qk W| | 7} q9 Wg  } xB |  i
 D]7 } |  i | i i p | i |  i | |   qqWd	 i	 |  } | | d	 7} | | d
 |  i 7} | d 7} | S(   s!   Return the wrapper for this classs   struct %s: %s
s   {
R\   i   s   , s   %s(PyObject* %s_%s):
i   s   %s(%s), %s(%s_) {}

s   
s   PyObject* %s;
s   };
(   R   R   R  R4  Rw   R   R   R  R  Rb   R  R   R   R2   R&   R"  (   R   Rd   Rt   Rg   Rx   Rw   R   t	   cons_codeR!  R  R  R  t   bodyR   (    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyR   u  s8    
 		 	(
 !
(   R   R   R   R   R  R  R"  R*  R   R  R4  R   R   (    (    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyR     s   			:	9		4		
(   t	   exportersR    R   t   settingst   policiesR   R   t   utilsR   R   R!   R   R   R   R#   R  t   objectR   (    (    (    s3   /usr/lib/pymodules/python2.6/Pyste/ClassExporter.pyt   <module>   s   


  |