HOME


sh-3ll 1.0
DIR:/usr/local/lib64/python3.6/site-packages/numpy/f2py/__pycache__/
Upload File :
Current File : //usr/local/lib64/python3.6/site-packages/numpy/f2py/__pycache__/f90mod_rules.cpython-36.pyc
3

���h&�@szdZddd�ZdZddlZddlmZddlmZdd	lm	Z	m
Z
dd
lTiZdd�Z
d
ej�jZdZdZdd�ZdS)aJ

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

z$Revision: 1.27 $�
�z
See `f2py -v`�N)�	capi_maps)�	func2subr)�undo_rmbadname�undo_rmbadname1)�*cCsTt|�r|gSt|�sgSg}x0|dD]$}t|�r@|j|�q(|t|�}q(W|S)N�body)Zismodule�hasbody�append�findf90modules)�m�ret�b�r�8/tmp/pip-build-5_djhm0z/numpy/numpy/f2py/f90mod_rules.pyr"sra�      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)) thenz�      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))z�      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$
Csddlm}gggddgddd�dggd�}d	g}|fd
d�}d	g}|fdd
�}�xvt|�D�]h}gggg|dggf\}}	}
}}}
g}g}g}t|�r�x|dD]}|j|d�q�WxL|dj�D]<}|d|}||ko�ttt�|�r�|
j|�|j|�q�Wt	d|d�|
�r.t	ddj
|
��d	g}|fdd�}d	g}|fdd�}tj|�}|d|d�|d|d�t
|��r�|d}t|t��r�dj
|�}||�|
�r�|d��xl|
D�]b}|d|}|j|�tj|�}tj|}tj||�}|djdd�j�}|jdd�j�}|�s,d}t}t|��r�d |k�r~d!|d k�r~|d"t|�|d#||d d!|f�t}n|d$t|�|d#||f�n|d$t|�|d#||f�|d%tj||��t
|��r|d}t|t��r�dj
|�}|d&|�t|��r�|	jd'|d|f�|
j|	d]�|jd(|�|jd)�|d*|d|f�|d+|	d^�|d,|dt|�f�|d-�|d.t|d.<tdt|d#�d�}|d/d0j
d1d2�|D���|d.||d.<|d3|	d_�n6|	j|�|jd4|�|jd5�|d6|d|f��q�W|
�r8|d7�t|��rސx�|dD�]�}t|��svtd8|d9|d��qN|jd:|d�|d|d;<|j |�\}} t!|��r�|d.| |d.<|	jd<|d|df�|jt"j#|dd=��nb| �r2|d.| |d.<|	jd<|d|df�|jt"j$|dd=��n|	j|d�|j|	d`�g|d><t%||�}!g|!d?<g|!d@<t&||!�}|dA|d|d|d|d|df�|jd4|d�|jdB�|d6|d|df��qNW|dC�|dD�dE|dd0j
|�|d.f|d.<dF|dk�r"dG}"nd}"|dH|"|d|dj'�d0j
|�f�|dI|d�|dJ|"|d|dj'�|df�|dK�|dL|||dL<dM|d|d|dfg|dN|dN<|d	�|dO|d�|�r
x&t(|�D]}#|dP|d|#f��q�W|�r,|dj
dQg|��|dR�|dS�|
�rZxt(|
�D]}#|dT|#��qDW|dUd0j
t(|	���|dV|d�|dj
|dW�jdXdY��g|dW<|d?jdZ|dd0j
t(|��f�q\Wd	|d[<g|d\<g|d@<|d.|dW<t)|d?�dk�rd	|d?<||d.fS)aNr)�rules�F_FUNCz
arrayobject.h�
)Z	includes0Zincludesz"Fortran 90/95 modules:\n")�f90modhooks�initf90modhooksr	ZneedZ
separatorsfor�docs�latexdoc�cSsd|d|f|d<dS)Nz%s
      %srr)�line�srrr�fadd`szbuildhooks.<locals>.faddcSsd|d|f|d<dS)Nz%s
%srr)rrrrr�dadddszbuildhooks.<locals>.dadd�namer	�varsz.		Constructing F90 module support for "%s"...
z		  Variables: %s
� cSsd|d|f|d<dS)Nz%s
%srr)rrrrr�caddzszbuildhooks.<locals>.caddcSsd|d|f|d<dS)Nz%s
%srr)rrrrr�iadd~szbuildhooks.<locals>.iaddz'static FortranDataDef f2py_%s_def[] = {z.\subsection{Fortran 90/95 module \texttt{%s}}
�notez\begin{description}Zdimsrz-1�:Zcharselector�lenz	{"%s",%s,{{%s,%s}},%s},Zrankz	{"%s",%s,{{%s}},%s},z\item[]{{}\verb@%s@{}}z--- %szf2py_%s_getdims_%sz.void (*%s)(int*,int*,void(*)(char*,int*),int*)z,void (*)(int*,int*,void(*)(char*,int*),int*)z!	f2py_%s_def[i_f2py++].func = %s;z#subroutine %s(r,s,f2pysetdata,flag)zuse %s, only: d => %s
z
integer flag
rz allocate(d(%s))
�,cSsg|]}d|�qS)zs(%s)r)�.0�irrr�
<listcomp>�szbuildhooks.<locals>.<listcomp>zend subroutine %szchar *%szchar*z!	f2py_%s_def[i_f2py++].data = %s;z\end{description}ZSkipping�blockz%s()�
modulenamezf2pywrap_%s_%s)�	signatureZexternroutinesrZdocshortz_	{"%s",-1,{{-1}},0,NULL,(void *)f2py_rout_#modulename#_%s_%s,doc_f2py_rout_#modulename#_%s_%s},zchar *z	{NULL}
};
�}z0static void f2py_setup_%s(%s) {
	int i_f2py=0;%s�_Z	F_FUNC_USz4extern void %s(f2pyinit%s,F2PYINIT%s)(void (*)(%s));z static void f2py_init_%s(void) {z*	%s(f2pyinit%s,F2PYINIT%s)(f2py_setup_%s);z}
rzN	PyDict_SetItemString(d, "%s", PyFortranObject_New(f2py_%s_def,f2py_init_%s));rz$subroutine f2pyinit%s(f2pysetupfunc)zuse %s, only : %sZ	interfacez
end interfacezexternal f2pysetupfunczexternal %szcall f2pysetupfunc(%s)zend subroutine f2pyinit%s
rz\subsection{z\subsubsection{z"	%s --- %s"Zroutine_defs�doc���r0r0r0)*rrrr
r�keysZl_orZ
isintent_hideZ	isprivateZoutmess�joinrZmodsign2mapZhasnote�
isinstance�listZgetctypeZ
c2capi_mapZ
getarrdims�replace�strip�	fgetdims2Z
isstringarrayr�fgetdims2_saZ
getarrdocsignZ
isallocatable�	fgetdims1�range�intZ	isroutine�printZbuildapiZ
isfunctionrZcreatefuncwrapperZcreatesubrwrapperZ
applyrulesZ
dictappend�upperrr%)$ZpymodrrZfhooksrr/rr
ZsargsZfargsZefargsZmodobjsZnotvarsZonlyvarsZsargspZifargsZmfargsr�n�varZchooksr!Zihooksr"Zvrdr#�ctZat�dmZdmsZ
use_fgetdims2�api�wrap�arr�arrr�
buildhooksWsH







"











&
" &
rFr0)�__doc__�__version__Zf2py_versionZnumpy�nprrrZcrackfortranrrZauxfuncs�optionsrZintp�itemsizer9r7r8rFrrrr�<module>s