Your IP : 216.73.216.213


Current Path : /opt/alt/python37/lib64/python3.7/site-packages/numpy/f2py/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/site-packages/numpy/f2py/__pycache__/f90mod_rules.cpython-37.pyc

B

��Fdd&�@s�dZddlmZmZmZddd�ZdZddlZdd	l	m
Z
dd
l	mZddlm
Z
mZddlTiZd
d�Zde��jadadZdd�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

�)�division�absolute_import�print_functionz$Revision: 1.27 $�
���z
See `f2py -v`N�)�	capi_maps)�	func2subr)�undo_rmbadname�undo_rmbadname1)�*cCsTt|�r|gSt|�sgSg}x0|dD]$}t|�r@|�|�q(|t|�}q(W|S)N�body)�ismodule�hasbody�append�findf90modules)�m�ret�b�r�J/opt/alt/python37/lib64/python3.7/site-packages/numpy/f2py/f90mod_rules.pyr#sra�      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$
Csddlm}gggddgddd�dggd�}d	g}|fd
d�}d	g}|fdd
�}�xnt|�D�]`}gggg|dggf\}}	}
}}}
g}g}g}t|�r�x|dD]}|�|d�q�WxJ|d��D]:}|d|}||kr�ttt�|�s�|
�|�|�|�q�Wt	d|d�|
�r,t	dd�
|
��d	g}|fdd�}d	g}|fdd�}t�|�}|d|d�|d|d�t
|��r�|d}t|t��r�d�
|�}||�|
�r�|d��xf|
D�]\}|d|}|�|�t�|�}tj|}t�||�}|d�dd���}|�dd���}|�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%t�||��t
|��r�|d}t|t��r�d�
|�}|d&|�t|��r�|	�d'|d|f�|
�|	d(�|�d)|�|�d*�|d+|d|f�|d,|	d(�|d-|dt|�f�|d.�|d/t|d/<td0|d#�}|d1d2�
d3d4�|D���|d/||d/<|d5|	d(�n6|	�|�|�d6|�|�d7�|d8|d|f��q�W|
�r0|d9�t|��r֐x�|dD�]�}t|��sntd:|d;|d��qF|�d<|d�|d|d=<|�|�\}} t |��r�|d/| |d/<|	�d>|d|df�|�t!j"|dd?��nb| �r*|d/| |d/<|	�d>|d|df�|�t!j#|dd?��n|	�|d�|�|	d(�g|d@<t$||�}!g|!dA<g|!dB<t%||!�}|dC|d|d|d|d|df�|�d6|d�|�dD�|d8|d|df��qFW|dE�|dF�dG|dd2�
|�|d/f|d/<dH|dk�rdI}"nd}"|dJ|"|d|d�&�d2�
|�f�|dK|d�|dL|"|d|d�&�|df�|dM�|dN|||dN<dO|d|d|dfg|dP|dP<|d	�|dQ|d�|�rx&t'|�D]}#|dR|d|#f��q�W|�r$|d�
dSg|��|dT�|dU�|
�rRxt'|
�D]}#|dV|#��q<W|dWd2�
t'|	���|dX|d�|d�
|dY��dZd[��g|dY<|dA�d\|dd2�
t'|��f�q\Wd	|d]<g|d^<g|dB<|d/|dY<t(|dA�dk�rd	|dA<||d/fS)_Nr)�rules�F_FUNCz
arrayobject.h�
)Z	includes0�includesz"Fortran 90/95 modules:\n")�f90modhooks�initf90modhooksr
ZneedZ
separatorsfor�docs�latexdoc�cSsd|d|f|d<dS)Nz%s
      %srr)�line�srrr�faddbszbuildhooks.<locals>.faddcSsd|d|f|d<dS)Nz%s
%srr)r r!rrr�daddfszbuildhooks.<locals>.dadd�namer
�varsz.		Constructing F90 module support for "%s"...
z		  Variables: %s
� cSsd|d|f|d<dS)Nz%s
%srr)r r!rrr�cadd|szbuildhooks.<locals>.caddcSsd|d|f|d<dS)Nz%s
%srr)r r!rrr�iadd�szbuildhooks.<locals>.iaddz'static FortranDataDef f2py_%s_def[] = {z.\subsection{Fortran 90/95 module \texttt{%s}}
�notez\begin{description}Zdimsrz-1�:Zcharselector�lenz	{"%s",%s,{{%s,%s}},%s},Zrankz	{"%s",%s,{{%s}},%s},z\item[]{{}\verb@%s@{}}z--- %szf2py_%s_getdims_%srz.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
range(1,%s+1)z 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))rrrrr�keysZl_orZ
isintent_hideZ	isprivateZoutmess�joinrZmodsign2mapZhasnote�
isinstance�listZgetctypeZ
c2capi_mapZ
getarrdims�replace�strip�	fgetdims2Z
isstringarrayr�fgetdims2_saZ
getarrdocsignZ
isallocatable�	fgetdims1�eval�	isroutine�printZbuildapi�
isfunctionr	ZcreatefuncwrapperZcreatesubrwrapperZ
applyrulesZ
dictappend�upperr
r+)$ZpymodrrZfhooksr"r5r#rZsargs�fargsZefargsZmodobjsZnotvarsZonlyvarsZsargspZifargsZmfargsr�n�varZchooksr'Zihooksr(Zvrdr)�ctZat�dmZdmsZ
use_fgetdims2Zapi�wrap�arr�arrr�
buildhooksXsH







"











&
" &
rL)�__doc__�
__future__rrr�__version__Zf2py_version�numpy�nprrr	Zcrackfortranr
rZauxfuncs�optionsrZintp�itemsizer>r<r=rLrrrr�<module>s