a ;jg$&@szdZdddZdZddlZddlmZdd lmZdd lm Z m Z dd l TiZ d d Z dejZdZdZddZdS)a2 Build F90 module support for f2py2e. Copyright 1999 -- 2011 Pearu Peterson all rights reserved. Copyright 2011 -- present NumPy Developers. 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. z$Revision: 1.27 $ z See `f2py -v`N) capi_maps) func2subr)undo_rmbadnameundo_rmbadname1)*cCsPt|r|gSt|sgSg}|dD]$}t|r>||q&|t|}q&|S)Nbody)ismodulehasbodyappendfindf90modules)mretbrA/usr/local/lib/python3.9/site-packages/numpy/f2py/f90mod_rules.pyrs  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|}t|D]0}tdd|dD} gggg|dggf\} } } } }}g}g}g}t|r|dD]}||dq|dD]:}|d|}||vrtt t |s||||qt d|d|d|vrP| sPt d|ddq`|rht dd |d g}|fdd}d g}|fdd}t |}|d|d|d|dt|r|d}t|trd |}|||r|d|D]}|d|}| |t |}t j|}t ||}|d d!d"}|d#d"}|sbd"}t} |d$t||d%||t |f|d&t ||t|r|d}t|trd |}|d'|t|r| d(|d|f| | d)| d*||d+|d,|d|f|d-| d)|d.|dt|f|d/|d0t|d0<tdt|d%d}|d1d2 d3d4|D|d0| |d0<|d5| d)n6| || d6||d7|d8|d|fq|r|d9t|r|dD]}t|sLt d:|d;d|ddq| d<|d|d|d=<| |\}!}"t!|r|d0|"|d0<| d>|d|df|t"j#|dd?nb|"r|d0|"|d0<| 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|dfq|dE|dFdG|dd2 | |d0f|d0<dH|dvrdI}$nd}$|dJ|$|d|d'd2 |f|dK|d|dL|$|d|d'|df|dM|dN|||dN<dO|d|d|dfg|dP|dP<|d |dQ|d|rt(|D]}%|dR|d|%fq|r|d dSg||dT|dU| r&t(| D]}%|dV|%q|dWd2 t(| |dX|d|d |dYdZd[g|dY<|dAd\|dd2 t(| fq`d |d]<g|d^<g|dB<|d0|dY<t)|dAdkrd |dA<||d0fS)_Nr)rulesF_FUNCz arrayobject.h )Z includes0Zincludesz"Fortran 90/95 modules:\n") f90modhooksinitf90modhooksr ZneedZ separatorsfordocslatexdoccSsd|d|f|d<dS)Nz %s %srrlinesrrrfadd[szbuildhooks..faddcSsd|d|f|d<dSNz%s %srrrrrrdadd_szbuildhooks..daddcss|]}|ddvr|VqdS)block)functionZ subroutineNr).0itemrrr dszbuildhooks..r namevarsz. Constructing F90 module support for "%s"... z Skipping z since it is in 'use'... z Variables: %s  cSsd|d|f|d<dSr rrrrrcadd}szbuildhooks..caddcSsd|d|f|d<dSr rrrrriaddszbuildhooks..iaddz'static FortranDataDef f2py_%s_def[] = {z.\subsection{Fortran 90/95 module \texttt{%s}} notez\begin{description}dimsr z-1:z {"%s",%s,{{%s}},%s, %s},Zrankz\item[]{{}\verb@%s@{}}z--- %szf2py_%s_getdims_%srz8void (*%s)(int*,npy_intp*,void(*)(char*,npy_intp*),int*)z6void (*)(int*,npy_intp*,void(*)(char*,npy_intp*),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)r$irrr zbuildhooks..zend subroutine %szchar *%szchar*z! f2py_%s_def[i_f2py++].data = %s;z\end{description}z"f90mod_rules.buildhooks: skipping r"z%s() modulenamezf2pywrap_%s_%s) signatureZexternroutinesrZdocshortza {"%s",-1,{{-1}},0,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 f2pysetupfuncz external %szcall f2pysetupfunc(%s)zend subroutine f2pyinit%s rz \subsection{z\subsubsection{z " %s --- %s"Z routine_defsdoc)*rrZ getuseblocksranyr r keysZl_orZ isintent_hideZ isprivateZoutmessjoinrZ modsign2mapZhasnote isinstancelistZgetctypeZ c2capi_mapZ getarrdimsreplacestrip fgetdims2rZ get_elsizeZ getarrdocsignZ isallocatable fgetdims1rangeint isroutineZbuildapi isfunctionrZcreatefuncwrapperZcreatesubrwrapperZ applyrulesZ dictappendupperrlen)&ZpymodrrZfhooksrr7r!ZusenamesrZ!contains_functions_or_subroutinesZsargsZfargsZefargsZmodobjsZnotvarsZonlyvarsZsargspZifargsZmfargsrnvarZchooksr*Zihooksr+Zvrdr,ctatdmZdmsZ use_fgetdims2apiwraparrarrr buildhooksRs~                                            rP)__doc__ __version__Z f2py_versionnumpynprrrZ crackfortranrrZauxfuncsoptionsrZintpitemsizer@r?Z fgetdims2_sarPrrrrs