o 6aS&@szdZdddZdZddlZddlmZdd lmZdd lm Z m Z dd l TiZ d d Z dejZdZdZddZdS)aJ Build F90 module support for f2py2e. Copyright 2000 Pearu Peterson all rights reserved, Pearu Peterson 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_rmbadnameundo_rmbadname1)*cCsPt|r|gSt|s gSg}|dD]}t|r||q|t|}q|S)Nbody)ismodulehasbodyappendfindf90modules)mretbr9/usr/lib/python3/dist-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$ Csddlm}gggddgddddggd}d g}|fd d }d g}|fd d }t|D]}gggg|dggf\}} } } } } g}g}g}t|rX|dD] }| |dqN|dD]}|d|}|| vr{ttt|s{| |||q^t d|d| rt dd | d g}|fdd}d g}|fdd}t |}|d|d|d|dt |r|d}t|trd |}||| r|d| D]0}|d|}| |t |}t j|}t ||}|ddd}|dd}|s d}t}t|rAd |vr2d!|d vr2|d"t||d#||d d!|ft}n|d$t||d#||fn|d$t||d#||f|d%t ||t |rs|d}t|trmd |}|d&|t|r| d'|d|f| | d(|d)||d*|d+|d|f|d,| d(|d-|dt|f|d.|d/t|d/<tdt|d#d}|d0d1 d2d3|D|d/||d/<|d4| d(q| ||d5||d6|d7|d|fq| r |d8t|r|dD]}t|s.t d9|d:d|ddq| d;|d|d|d<<||\}} t |ri|d/| |d/<| d=|d|df|t!j"|dd>n1| r|d/| |d/<| d=|d|df|t!j#|dd>n| |d|| d(g|d?<t$||}!g|!d@<g|!dA<t%||!}|dB|d|d|d|d|df|d5|d|dC|d7|d|dfq|dD|dEdF|dd1 ||d/f|d/<dG|dvrdH}"nd}"|dI|"|d|d&d1 |f|dJ|d|dK|"|d|d&|df|dL|dM|||dM<dN|d|d|dfg|dO|dO<|d |dP|d|rut'|D] }#|dQ|d|#fqg|r|d dRg||dS|dT| rt'| D] }#|dU|#q|dVd1 t'| |dW|d|d |dXdYdZg|dX<|d@d[|dd1 t'| fq,d |d\<g|d]<g|dA<|d/|dX<t(|d@dkrd |d@<||d/fS)^Nr)rulesF_FUNCz arrayobject.h ) includes0includesz"Fortran 90/95 modules:\n") f90modhooksinitf90modhooksr need separatorsfordocslatexdoccSd|d|f|d<dS)Nz %s %srrlinesrrrfadd`zbuildhooks..faddcSr Nz%s %srrr!rrrdadddr%zbuildhooks..daddnamer varsz. Constructing F90 module support for "%s"... z Variables: %s  cSr r&rr!rrrcaddzr%zbuildhooks..caddcSr r&rr!rrriadd~r%zbuildhooks..iaddz'static FortranDataDef f2py_%s_def[] = {z.\subsection{Fortran 90/95 module \texttt{%s}} notez\begin{description}dimsr z-1: charselectorlenz {"%s",%s,{{%s,%s}},%s},rankz {"%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 allocate(d(%s)) ,cSsg|]}d|qS)zs(%s)r).0irrr szbuildhooks..zend subroutine %szchar *%szchar*z! f2py_%s_def[i_f2py++].data = %s;z\end{description}z"f90mod_rules.buildhooks: skipping blockz%s() modulenamezf2pywrap_%s_%s) signatureexternroutinesrdocshortz_ {"%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_ 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 : %s interfacez end interfacezexternal f2pysetupfuncz external %szcall f2pysetupfunc(%s)zend subroutine f2pyinit%s rz \subsection{z\subsubsection{z " %s --- %s" routine_defsdoc))rrrr r keysl_or isintent_hide isprivateoutmessjoinr modsign2maphasnote isinstancelistgetctype c2capi_map getarrdimsreplacestrip fgetdims2 isstringarrayr fgetdims2_sa getarrdocsign isallocatable fgetdims1rangeint isroutinebuildapi isfunctionrcreatefuncwrappercreatesubrwrapper applyrules dictappendupperrr1)$pymodrrfhooksr$rAr'rsargsfargsefargsmodobjsnotvarsonlyvarssargspifargsmfargsrnvarchooksr+ihooksr,vrdr-ctatdmdms use_fgetdims2apiwraparrarrr buildhooksWs                                               rz)__doc__ __version__ f2py_versionnumpynprrr crackfortranrrauxfuncsoptionsrintpitemsizerVrQrSrzrrrrs