ó
ØÆ÷Xc           @` s¼   d  Z  d d l m Z m Z m Z d d d !Z d Z d d l Z d d	 l	 m
 Z
 d d
 l	 m Z d d l m Z m Z d d l Ti  Z d „  Z d e j ƒ  j a d a d Z d „  Z d S(   sJ  

Build F90 module support for f2py2e.

Copyright 2000 Pearu Peterson all rights reserved,
Pearu Peterson <pearu@ioc.ee>
Permission to use, modify, and distribute this software is given under the
terms of the NumPy License.

NO WARRANTY IS EXPRESSED OR IMPLIED.  USE AT YOUR OWN RISK.
$Date: 2005/02/03 19:30:23 $
Pearu Peterson

i    (   t   divisiont   absolute_importt   print_functions   $Revision: 1.27 $i
   iÿÿÿÿs   See `f2py -v`Ni   (   t	   capi_maps(   t	   func2subr(   t   undo_rmbadnamet   undo_rmbadname1(   t   *c         C` sn   t  |  ƒ r |  g St |  ƒ s# g  Sg  } x> |  d D]2 } t  | ƒ rV | j | ƒ q4 | t | ƒ } q4 W| S(   Nt   body(   t   ismodulet   hasbodyt   appendt   findf90modules(   t   mt   rett   b(    (    s6   /tmp/pip-build-X4mzal/numpy/numpy/f2py/f90mod_rules.pyR   $   s    s        external f2pysetdata
      logical ns
      integer r,i
      integer(%d) s(*)
      ns = .FALSE.
      if (allocated(d)) then
         do i=1,r
            if ((size(d,i).ne.s(i)).and.(s(i).ge.0)) then
               ns = .TRUE.
            end if
         end do
         if (ns) then
            deallocate(d)
         end if
      end if
      if ((.not.allocated(d)).and.(s(1).ge.1)) thens«         end if
      if (allocated(d)) then
         do i=1,r
            s(i) = size(d,i)
         end do
      end if
      flag = 1
      call f2pysetdata(d,allocated(d))sÕ         end if
      if (allocated(d)) then
         do i=1,r
            s(i) = size(d,i)
         end do
         !s(r) must be equal to len(d(1))
      end if
      flag = 2
      call f2pysetdata(d,allocated(d))c   %   
   C` sK
  d d l  m } i g  d 6g  d 6g  d 6d d g d 6i d	 d
 6d	 d 6d 6d g d 6g  d 6} d g } | d „ } d g } | d „ } xc	t |  ƒ D]U	} g  g  g  g  | d g g  f \ } }	 }
 } } } g  } g  } g  } t | ƒ rx& | d D] } | j | d ƒ qõ Wn  xe | d j ƒ  D]S } | d | } | | k r$t t t ƒ | ƒ r$| j | ƒ | j | ƒ q$q$Wt	 d | d ƒ | r­t	 d d j
 | ƒ ƒ n  d g } | d „ } d g } | d „ } t j | ƒ } | d | d ƒ | d | d ƒ t | ƒ rN| d } t | t ƒ rAd	 j
 | ƒ } n  | | ƒ n  | ra| d ƒ n  x| D]} | d | } | j | ƒ t j | ƒ } t j | } t j | | ƒ } | d j d d  ƒ j ƒ  } | j d! d  ƒ j ƒ  } | súd  } n  t } t | ƒ r‡d" | k r`d# | d" k r`| d$ t | ƒ | d% | | d" d# | f ƒ t } q«| d& t | ƒ | d% | | f ƒ n$ | d& t | ƒ | d% | | f ƒ | d' t j | | ƒ ƒ t | ƒ r| d } t | t ƒ rüd	 j
 | ƒ } n  | d( | ƒ n  t | ƒ r0|	 j d) | d | f ƒ |
 j |	 d* ƒ | j d+ | ƒ | j d, ƒ | d- | d | f ƒ | d. |	 d* ƒ | d/ | d t | ƒ f ƒ | d0 ƒ | d1 t | d1 <t d2 | d% ƒ } | d3 d4 j
 g  | D] } d5 | ^ qîƒ ƒ | d1 | | d1 <| d6 |	 d* ƒ qh|	 j | ƒ | j d7 | ƒ | j d8 ƒ | d9 | d | f ƒ qhW| rŠ| d: ƒ n  t | ƒ rxö| d D]ç} t | ƒ sÑt d; | d< | d ƒ q¡n  | j d= | d ƒ | d | d> <| j | ƒ \ }  }! t  | ƒ re| d1 |! | d1 <|	 j d? | d | d f ƒ | j t! j" | d@ d ƒƒ nx |! r»| d1 |! | d1 <|	 j d? | d | d f ƒ | j t! j# | d@ d ƒƒ n" |	 j | d ƒ | j |	 d* ƒ g  |  dA <t$ |  | ƒ }" g  |" d <g  |" dB <t% | |" ƒ } | dC | d | d | d | d | d f ƒ | j d7 | d ƒ | j dD ƒ | d9 | d | d f ƒ q¡Wn  | dE ƒ | dF ƒ dG | d d4 j
 | ƒ | d1 f | d1 <dH | d k rädI }# n d }# | dJ |# | d | d j& ƒ  d4 j
 | ƒ f ƒ | dK | d ƒ | dL |# | d | d j& ƒ  | d f ƒ | dM ƒ | d | | | d <dN | d | d | d f g | d | d <| d ƒ | dO | d ƒ | rûx/ t' | ƒ D] }$ | dP | d |$ f ƒ qÖWn  | r(	| d j
 dQ g | ƒ ƒ | dR ƒ n  | dS ƒ |
 r`	x% t' |
 ƒ D] }$ | dT |$ ƒ qE	Wn  | dU d4 j
 t' |	 ƒ ƒ ƒ | dV | d ƒ | d	 j
 | d ƒ j dW dX ƒ ƒ g  | d <| d j dY | d d4 j
 t' | ƒ ƒ f ƒ q• Wd | dZ <g  | d[ <g  | dB <| d1 | d <t( | d ƒ d k r=
d | d <n  | | d1 f S(\   Ni   (   t   rulest   f90modhookst   initf90modhooksR   t   F_FUNCs   arrayobject.ht   needs   
t	   includes0t   includest   separatorsfors   "Fortran 90/95 modules:\n"t   docst   latexdoct    c         S` s   d | d |  f | d <d  S(   Ns   %s
      %si    (    (   t   linet   s(    (    s6   /tmp/pip-build-X4mzal/numpy/numpy/f2py/f90mod_rules.pyt   faddc   s    c         S` s   d | d |  f | d <d  S(   Ns   %s
%si    (    (   R   R   (    (    s6   /tmp/pip-build-X4mzal/numpy/numpy/f2py/f90mod_rules.pyt   daddg   s    t   namet   varss.   		Constructing F90 module support for "%s"...
s   		  Variables: %s
t    c         S` s   d | d |  f | d <d  S(   Ns   %s
%si    (    (   R   R   (    (    s6   /tmp/pip-build-X4mzal/numpy/numpy/f2py/f90mod_rules.pyt   cadd}   s    c         S` s   d | d |  f | d <d  S(   Ns   %s
%si    (    (   R   R   (    (    s6   /tmp/pip-build-X4mzal/numpy/numpy/f2py/f90mod_rules.pyt   iadd   s    s'   static FortranDataDef f2py_%s_def[] = {s.   \subsection{Fortran 90/95 module \texttt{%s}}
t   notes   \begin{description}t   dimsR   s   -1t   :t   charselectort   lens   	{"%s",%s,{{%s,%s}},%s},t   ranks   	{"%s",%s,{{%s}},%s},s   \item[]{{}\verb@%s@{}}s   --- %ss   f2py_%s_getdims_%siÿÿÿÿs.   void (*%s)(int*,int*,void(*)(char*,int*),int*)s,   void (*)(int*,int*,void(*)(char*,int*),int*)s!   	f2py_%s_def[i_f2py++].func = %s;s#   subroutine %s(r,s,f2pysetdata,flag)s   use %s, only: d => %s
s   integer flag
i    s   range(1,%s+1)s    allocate(d(%s))
t   ,s   s(%s)s   end subroutine %ss   char *%ss   char*s!   	f2py_%s_def[i_f2py++].data = %s;s   \end{description}t   Skippingt   blocks   %s()t
   modulenames   f2pywrap_%s_%st	   signaturet   externroutinest   docshorts_   	{"%s",-1,{{-1}},0,NULL,(void *)f2py_rout_#modulename#_%s_%s,doc_f2py_rout_#modulename#_%s_%s},s   char *s   	{NULL}
};
t   }s0   static void f2py_setup_%s(%s) {
	int i_f2py=0;%st   _t	   F_FUNC_USs4   extern void %s(f2pyinit%s,F2PYINIT%s)(void (*)(%s));s    static void f2py_init_%s(void) {s*   	%s(f2pyinit%s,F2PYINIT%s)(f2py_setup_%s);s   }
sN   	PyDict_SetItemString(d, "%s", PyFortranObject_New(f2py_%s_def,f2py_init_%s));s$   subroutine f2pyinit%s(f2pysetupfunc)s   use %s, only : %st	   interfaces   end interfaces   external f2pysetupfuncs   external %ss   call f2pysetupfunc(%s)s   end subroutine f2pyinit%s
s   \subsection{s   \subsubsection{s   "	%s --- %s"t   routine_defst   doc()   R   R   R   R
   R   t   keyst   l_ort   isintent_hidet	   isprivatet   outmesst   joinR   t   modsign2mapt   hasnotet
   isinstancet   listt   getctypet
   c2capi_mapt
   getarrdimst   replacet   stript	   fgetdims2t   isstringarrayR   t   fgetdims2_sat   getarrdocsignt   isallocatablet	   fgetdims1t   evalt	   isroutinet   printt   buildapit
   isfunctionR   t   createfuncwrappert   createsubrwrappert
   applyrulest
   dictappendt   upperR   R(   (%   t   pymodR   R   t   fhooksR   R6   R   R   t   sargst   fargst   efargst   modobjst   notvarst   onlyvarst   sargspt   ifargst   mfargsR   t   nt   vart   chooksR"   t   ihooksR#   t   vrdR$   t   ctt   att   dmt   dmst   use_fgetdims2t   it   apit   wrapt   arR   t   a(    (    s6   /tmp/pip-build-X4mzal/numpy/numpy/f2py/f90mod_rules.pyt
   buildhooksY   sH   

		%"		
	)	!

(


+

%	+&
+





(   t   __doc__t
   __future__R    R   R   t   __version__t   f2py_versiont   numpyt   npR   R   R   t   crackfortranR   R   t   auxfuncst   optionsR   t   intpt   itemsizeRK   RF   RH   Rp   (    (    (    s6   /tmp/pip-build-X4mzal/numpy/numpy/f2py/f90mod_rules.pyt   <module>   s   
	
