Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/site-packages/numpy/f2py/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/site-packages/numpy/f2py/__pycache__/f90mod_rules.cpython-35.pyc



(��^d&�@s�dZddlmZmZmZddd�ZdZddlZddl	m
Z
dd	l	mZdd
lm
Z
mZddlTiZdd
�Zdej�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)�*cCsnt|�r|gSt|�s#gSg}x>|dD]2}t|�rV|j|�q4|t|�}q4W|S)N�body)�ismodule�hasbody�append�findf90modules)�m�ret�b�r�J/opt/alt/python35/lib64/python3.5/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}dgdgdgdddgd	d
dddid
dgdgi}dg}|dd�}dg}|dd�}x2	t|�D]$	}gggg|dggf\}}	}
}}}
g}g}g}t|�r
x#|dD]}|j|d�q�Wxb|dj�D]P}|d|}||krttt�|�r|
j|�|j|�qWt	d|d�|
r�t	ddj
|
��dg}|dd�}dg}|dd�}tj|�}|d|d�|d|d�t
|�rB|d }t|t�r8dj
|�}||�|
rR|d!�x|
D]�}|d|}|j|�tj|�}tj|}tj||�}|d"jd#d$�j�}|jd%d$�j�}|s�d$}t}t|�rud&|krNd'|d&krN|d(t|�|d)||d&d'|f�t}q�|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/�|d0|d|f�|d1|	da�|d2|dt|�f�|d3�|d4t|d4<td5|d)�}|d6d7j
d8d9�|D���|d4||d4<|d:|	db�qY|	j|�|jd;|�|jd<�|d=|d|f�qYW|
re|d>�t|�rdx�|dD]�}t|�s�td?|d@|d�q||jdA|d�|d|dB<|j|�\}} t |�r=|d4| |d4<|	jdC|d|df�|jt!j"|dDd��nx| r�|d4| |d4<|	jdC|d|df�|jt!j#|dDd��n"|	j|d�|j|	dc�g|dE<t$||�}!g|!d
<g|!dF<t%||!�}|dG|d|d|d|d|df�|jd;|d�|jdH�|d=|d|df�q|W|dI�|dJ�dK|dd7j
|�|d4f|d4<dL|dkr�dM}"nd}"|dN|"|d|dj&�d7j
|�f�|dO|d�|dP|"|d|dj&�|df�|dQ�|d|||d<dR|d|d|dfg|d|d<|d�|dS|d�|r�x,t'|�D]}#|dT|d|#f�q�W|r�|dj
dUg|��|dV�|dW�|
r,	x"t'|
�D]}#|dX|#�q	W|dYd7j
t'|	���|dZ|d�|dj
|d�jd[d\��g|d<|d
jd]|dd7j
t'|��f�q�Wd|d^<g|d_<g|dF<|d4|d<t(|d
�dkr
d|d
<||d4fS)dNr)�rulesZf90modhooksZinitf90modhooksrZneed�F_FUNCz
arrayobject.hZ
separatorsforZ	includes0�
�includesZdocsz"Fortran 90/95 modules:\n"Zlatexdoc�cSsd|d|f|d<dS)Nz%s
      %srr)�line�srrr�faddbszbuildhooks.<locals>.faddcSsd|d|f|d<dS)Nz%s
%srr)rrrrr�daddfszbuildhooks.<locals>.dadd�name�varsz.		Constructing F90 module support for "%s"...
z		  Variables: %s
� cSsd|d|f|d<dS)Nz%s
%srr)rrrrr�cadd|szbuildhooks.<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
range(1,%s+1)z allocate(d(%s))
�,cSsg|]}d|�qS)zs(%s)r)�.0�irrr�
<listcomp>�s	zbuildhooks.<locals>.<listcomp>zend subroutine %szchar *%szchar*z!	f2py_%s_def[i_f2py++].data = %s;z\end{description}ZSkipping�blockz%s()�
modulenamezf2pywrap_%s_%s�	signatureZexternroutinesZdocshortz_	{"%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}
zN	PyDict_SetItemString(d, "%s", PyFortranObject_New(f2py_%s_def,f2py_init_%s));z$subroutine f2pyinit%s(f2pysetupfunc)zuse %s, only : %sZ	interfacez
end interfacezexternal f2pysetupfunczexternal %szcall f2pysetupfunc(%s)zend subroutine f2pyinit%s
z\subsection{z\subsubsection{z"	%s --- %s"Zroutine_defs�doc���r1r1r1))rrrrr�keysZl_orZ
isintent_hideZ	isprivateZoutmess�joinrZmodsign2mapZhasnote�
isinstance�listZgetctypeZ
c2capi_mapZ
getarrdims�replace�strip�	fgetdims2Z
isstringarrayr
�fgetdims2_saZ
getarrdocsignZ
isallocatable�	fgetdims1�eval�	isroutine�printZbuildapi�
isfunctionrZcreatefuncwrapperZcreatesubrwrapperZ
applyrulesZ
dictappend�upperr	r&)$ZpymodrrZfhooksrr0rrZsargs�fargsZefargsZmodobjsZnotvarsZonlyvarsZsargspZifargsZmfargsr�n�varZchooksr"Zihooksr#Zvrdr$�ctZat�dmZdmsZ
use_fgetdims2Zapi�wrap�arr�arrr�
buildhooksXsH			%"
		





)	!








+


%	+&
+








rHr1)�__doc__�
__future__rrr�__version__Zf2py_version�numpy�nprrrZcrackfortranr	r
Zauxfuncs�optionsrZintp�itemsizer:r8r9rHrrrr�<module>s