B
    n\              2   @   sX  d Z ddlmZmZmZ ddd ZddlmZ ejaddl	Z	ddl
Z
ddlZdd	lmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZI dd
lmJZJ ddlmKZK ddlmLZL ddlmMZM ddlmNZN ddlmOZO i aPi ZQxdD ]ZRdeQeR< qW eSe	jTUde

 ZVde
We
XeV d ed d ed d ed d ed d ed d ed d  ed! d" ed# d$ ed% d& ed' d( ed) d* ed+ d, ed- d. ed/ d0 ed1 d2 d3 d.d.d4d5d6d7gd8d9gd:ZYd;d<d=d>d?d@dAdBdBedCeEedBidD
gZZeQdEdFdGdHdIdJdKdLdMdNgedOidPdQgdRgdSZ[ddddddTdddddUddddddVdBdBdBdBdBdBdWdXdBdBdBdBdYdZd[d\d]d^d_d`dBdBdBdadbgdcddgdedfdgdhdidBdBdBdBdBdBdBdBdBdBdBdBdBedjeEedBidk/dldmdBeEe2dndodpdBe2dndqeDeEeFe2e$eEedreDeEe2e$eEedse2dBedBieEeFe2e$edteDeEe2e$eEedueDeEe2edvieDeEeFe2e$eEedwiedxgiedyie<dzied{ieEeFeed|ie<d}ied~igeDe:eEe;ddqeEeFe2ededBieEeFe2ededvieEeFe2edieEeFe2eddwgiedgiedie<dieEeFeediedie<diedige!ddqeEeFe2ededBieEeFe2ededvieEeFe2edieEeFe2eddwgiedgiedie<dieEeFeediedie<diedige;ddeEe'diddedigeDee9dieDeeEe9digeDe eEe!deDeEeFe2e$eEedeDeEe2e$eEededBieDeEeFe2e$eEedteDeEe2e$eEeduedviedeEediedigedie<diedieEeFeedie<diedieDeedieDeeEedigedieEedwiedie1die/digeEe'diedeEeFee'dieDe eEe9eEe!d	dreEeFe2e$dteDeEe2e$duiddgdddddddddedyie<dide<died~iedidgddddwddgeDe9eEe!d
dddedg
Z\e0de.de-de>deBde=de@de?deCdeAde6diZ]deQidedigde]dŜdediedieDe5eEedɜddddeDe5eEee*d͜dediedМddgdge7dԜdddgdediedMigedԜdeDeeEeideDeeEee)ide"dBdڜde?dBdڜdeCdBdڜdeAdBdڜdedBdڜedide8dݜgZ^deQidedigddBe]dߜeDe3e)dieDe4e)die*dieDe3e)dedjigieDe4e)dedjigie*deDee'djeDee)digidBdddeDe)eEe3ddddeDe)e3ddde*de)die)die)didde)diddddeEe%dige)die4die3die)die4die3diddeEe%diddgedeEe%die%d idedeEe%digidgdddgedBdded	ie$deEe$d
ie*dieDe5eEededieDe5eEedde4die3die4die3die(die(die(dieDe5eEee)d	edddBieDe3eEedddBieEe,die,digdeEe,dieDe5eEee)dBdedie]eDe5eEee'dBded	ieDe5eEedBdde$deEe$d
iedie*diedde4die3die4die3die(die(die(dieDee)d	ed ieDe3eEedidgd!dgeDee)dBde*dieDee'd"edieDee'dBde*d#idged$ediedBddddgdd%ed&ie*didge7d'd(d)dddge7dBde4die3die4die3die(d*ie(die(dieDe7e)d+deDe7e'ied&ie7dBddddאd,d-gde*d.ided/d0d1d2d3d4d5d6eDee+d7d8eDee+dBdd9d1d2d3d:d5d;eDee&d7d8eDee&dBdediedMigedBdڜde4die3die4die3dieDee)d<d=d>e'd?ie)d@idAee)dBie'dCiedDidEgigdFeEeFe*e'dGieDe'eEe*dHiedIigedBdJdeDeeEeideDeeEee)ide"dBdڜde?dBdڜdeCdBdڜdeAdBdڜdedBdڜedide8dݜg*Z_edKidӐdLdMdNdOeDe5eEedBdPdQdRdSe7dBdPdTdUdVedBdWdXdYdZd[gZ`d\d] Zad^d_d`dadadadadadadadb
Zbdcdd ZcdS (e  aG  

Rules for building C/API module with f2py2e.

Here is a skeleton of a new wrapper function (13Dec2001):

wrapper_function(args)
  declarations
  get_python_arguments, say, `a' and `b'

  get_a_from_python
  if (successful) {

    get_b_from_python
    if (successful) {

      callfortran
      if (successful) {

        put_a_to_python
        if (successful) {

          put_b_to_python
          if (successful) {

            buildvalue = ...

          }

        }

      }

    }
    cleanup_b

  }
  cleanup_a

  return buildvalue

Copyright 1999,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/08/30 08:58:42 $
Pearu Peterson

    )divisionabsolute_importprint_functionz$Revision: 1.129 $
      )__version__N)=
applyrules	debugcapi
dictappenderrmessgentitlegetargs2hascallstatementhasexternalshasinitvaluehasnotehasresultnoteisarrayisarrayofstrings	iscomplexiscomplexarrayiscomplexfunctioniscomplexfunction_warnisdummyroutine
isexternal
isfunctionisfunction_wrapisint1arrayisintent_aux
isintent_cisintent_callbackisintent_copyisintent_hideisintent_inoutisintent_nothideisintent_outisintent_overwrite	islogicalislong_complexislong_doubleislong_doublefunctionislong_longislong_longfunctionismoduleroutine
isoptional
isrequiredisscalarissigned_long_longarrayisstringisstringarrayisstringfunctionissubroutineissubroutine_wrapisthreadsafe
isunsignedisunsigned_charisunsigned_chararrayisunsigned_long_longisunsigned_long_longarrayisunsigned_shortisunsigned_shortarrayl_andl_notl_oroutmessreplace
stripcomma)	capi_maps)cfuncs)common_rules)	use_rules)f90mod_rules)	func2subr)decl	frompyobjcleanupfrompyobjtopyarrmethod	pyobjfromclosepyobjfromfreememuserincludes	includes0includestypedefstypedefs_generated	cppmacrosrG   	callbackslatexdocrestdocroutine_defsexternroutinesinitf2pywraphookscommonhooksinitcommonhooksf90modhooksinitf90modhooks
SOURCE_DATE_EPOCHz/* File: #modulename#module.c
 * This file is auto-generated with f2py (version:#f2py_version#).
 * f2py is a Fortran to Python Interface Generator (FPIG), Second Edition,
 * written by Pearu Peterson <pearu@cens.ioc.ee>.
 * Generation date: zv
 * Do not edit this file directly unless you know what you are doing!!!
 */

#ifdef __cplusplus
extern "C" {
#endif

zSee f2py2e/cfuncs.py: includesz
#includes#
#includes0#

z,See f2py2e/rules.py: mod_rules['modulebody']zM
static PyObject *#modulename#_error;
static PyObject *#modulename#_module;

zSee f2py2e/cfuncs.py: typedefsz
#typedefs#

z(See f2py2e/cfuncs.py: typedefs_generatedz
#typedefs_generated#

zSee f2py2e/cfuncs.py: cppmacrosz
#cppmacros#

zSee f2py2e/cfuncs.py: cfuncsz
#cfuncs#

z"See f2py2e/cfuncs.py: userincludesz
#userincludes#

z"See f2py2e/capi_rules.py: usercodez9
#usercode#

/* See f2py2e/rules.py */
#externroutines#

z#See f2py2e/capi_rules.py: usercode1z
#usercode1#

z%See f2py2e/cb_rules.py: buildcallbackz
#callbacks#

zSee f2py2e/rules.py: buildapiz	
#body#

z&See f2py2e/f90mod_rules.py: buildhooksz
#f90modhooks#

z/See f2py2e/rules.py: module_rules['modulebody']z

z&See f2py2e/common_rules.py: buildhooksz
#commonhooks#

zSee f2py2e/rules.pya  

static FortranDataDef f2py_routine_defs[] = {
#routine_defs#
	{NULL}
};

static PyMethodDef f2py_module_methods[] = {
#pymethoddef#
	{NULL,NULL}
};

#if PY_VERSION_HEX >= 0x03000000
static struct PyModuleDef moduledef = {
	PyModuleDef_HEAD_INIT,
	"#modulename#",
	NULL,
	-1,
	f2py_module_methods,
	NULL,
	NULL,
	NULL,
	NULL
};
#endif

#if PY_VERSION_HEX >= 0x03000000
#define RETVAL m
PyMODINIT_FUNC PyInit_#modulename#(void) {
#else
#define RETVAL
PyMODINIT_FUNC init#modulename#(void) {
#endif
	int i;
	PyObject *m,*d, *s;
#if PY_VERSION_HEX >= 0x03000000
	m = #modulename#_module = PyModule_Create(&moduledef);
#else
	m = #modulename#_module = Py_InitModule("#modulename#", f2py_module_methods);
#endif
	Py_TYPE(&PyFortran_Type) = &PyType_Type;
	import_array();
	if (PyErr_Occurred())
		{PyErr_SetString(PyExc_ImportError, "can't initialize module #modulename# (failed to import numpy)"); return RETVAL;}
	d = PyModule_GetDict(m);
	s = PyString_FromString("$Ra  evision: $");
	PyDict_SetItemString(d, "__version__", s);
#if PY_VERSION_HEX >= 0x03000000
	s = PyUnicode_FromString(
#else
	s = PyString_FromString(
#endif
		"This module '#modulename#' is auto-generated with f2py (version:#f2py_version#).\nFunctions:\n"
#docs#".");
	PyDict_SetItemString(d, "__doc__", s);
	#modulename#_error = PyErr_NewException ("#modulename#.error", NULL, NULL);
	Py_DECREF(s);
	for(i=0;f2py_routine_defs[i].name!=NULL;i++)
		PyDict_SetItemString(d, f2py_routine_defs[i].name,PyFortranObject_NewAsAttr(&f2py_routine_defs[i]));
#initf2pywraphooks#
#initf90modhooks#
#initcommonhooks#
#interface_usercode#

#ifdef F2PY_REPORT_ATEXIT
	if (! PyErr_Occurred())
		on_exit(f2py_report_on_exit,(void*)"#modulename#");
#endif

	return RETVAL;
}
#ifdef __cplusplus
}
#endif
)r[   r\   z*\section{Module \texttt{#texmodulename#}}
z
#modnote#
z
#latexdoc#zdModule #modulename#
================================================================================z

#restdoc#)
modulebodyseparatorsforr[   r\   z/*eof body*/z/*eof method*/z/*eof externroutines*/z/*eof routine_defs*/z/*eof initf90modhooks*/z/*eof initf2pywraphooks*/z/*eof initcommonhooks*/ z#note#)
bodyrP   r^   r]   rc   r_   ra   r[   r\   Zmodnotea  
#begintitle#
static char doc_#apiname#[] = "\
#docreturn##name#(#docsignatureshort#)\n\nWrapper for ``#name#``.\
\n#docstrsigns#";
/* #declfortranroutine# */
static PyObject *#apiname#(const PyObject *capi_self,
                           PyObject *capi_args,
                           PyObject *capi_keywds,
                           #functype# (*f2py_func)(#callprotoargument#)) {
	PyObject * volatile capi_buildvalue = NULL;
	volatile int f2py_success = 1;
#decl#
	static char *capi_kwlist[] = {#kwlist##kwlistopt##kwlistxa#NULL};
#usercode#
#routdebugenter#
#ifdef F2PY_REPORT_ATEXIT
f2py_start_clock();
#endif
	if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\
		"#argformat##keyformat##xaformat#:#pyname#",\
		capi_kwlist#args_capi##keys_capi##keys_xa#))
		return NULL;
#frompyobj#
/*end of frompyobj*/
#ifdef F2PY_REPORT_ATEXIT
f2py_start_call_clock();
#endif
#callfortranroutine#
if (PyErr_Occurred())
  f2py_success = 0;
#ifdef F2PY_REPORT_ATEXIT
f2py_stop_call_clock();
#endif
/*end of callfortranroutine*/
		if (f2py_success) {
#pyobjfrom#
/*end of pyobjfrom*/
		CFUNCSMESS("Building return value.\n");
		capi_buildvalue = Py_BuildValue("#returnformat#"#return#);
/*closepyobjfrom*/
#closepyobjfrom#
		} /*if (f2py_success) after callfortranroutine*/
/*cleanupfrompyobj*/
#cleanupfrompyobj#
	if (capi_buildvalue == NULL) {
#routdebugfailure#
	} else {
#routdebugleave#
	}
	CFUNCSMESS("Freeing memory.\n");
#freemem#
#ifdef F2PY_REPORT_ATEXIT
f2py_stop_clock();
#endif
	return capi_buildvalue;
}
#endtitle#
z#routine_def#z#initf2pywraphook#z#declfortranroutine#z!#docreturn##name#(#docsignature#)z&#docreturn##name#(#docsignatureshort#)z'"	#docreturn##name#(#docsignature#)\n"
zarrayobject.hZ
CFUNCSMESSZMINMAXz#define DEBUGCFUNCSz1\subsection{Wrapper function \texttt{#texname#}}
zk
\noindent{{}\verb@#docreturn##name#@{}}\texttt{(#latexdocsignatureshort#)}
#routnote#

#latexdocstrsigns#
zlWrapped function ``#name#``
--------------------------------------------------------------------------------)rg   ri   r]   r_   r^   docdocshortZdocsneedrY   r[   r\   z || z\n"
")callfortranroutineroutdebugenterrL   routdebugleaveroutdebugfailure	setjmpbuf	docstrreq	docstropt	docstrout	docstrcbsdocstrsignslatexdocstrsignslatexdocstrreqlatexdocstroptlatexdocstroutlatexdocstrcbsz/*decl*/z/*freemem*/z\nParameters\n----------z$\nOther Parameters\n----------------z\nReturns\n-------z'\nNotes\n-----\nCall-back functions::\nz\noindent Required arguments:z\noindent Optional arguments:z\noindent Return objects:z\noindent Call-back functions:z/*frompyobj*/z/*end of cleanupfrompyobj*/z/*pyobjfrom*/z/*end of closepyobjfrom*/z/*topyarr*/z/*routdebugleave*/z/*routdebugenter*/z/*routdebugfailure*/z/*callfortranroutine*/z
--- #note#)/rg   kwlist	kwlistoptcallfortrancallfortranappenddocsign
docsignoptrL   rS   Zdocsignshortdocsignoptshortrv   rw   rr   rs   rt   ru   rx   ry   rz   r{   	args_capi	keys_capifunctyperM   rN   rQ   rR   rO   ro   rn   rp   rm   	argformat	keyformatZneed_cfuncs	docreturnreturnreturnformatZrformatkwlistxakeys_xaxaformat	docsignxadocsignxashortinitf2pywraphookZroutnotezf2py_rout_#modulename#_#name#z#modulename#.#name#)ZapinameZpynamerL   _checkz-f2py_rout_#modulename#_#f90modulename#_#name#z##modulename#.#f90modulename#.#name#ZvoidzGextern void #F_FUNC#(#fortranname#,#FORTRANNAME#)(#callprotoargument#);z/extern void #fortranname#(#callprotoargument#);zn	{"#name#",-1,{{-1}},0,(char *)#F_FUNC#(#fortranname#,#FORTRANNAME#),(f2py_init_func)#apiname#,doc_#apiname#},zV	{"#name#",-1,{{-1}},0,(char *)#fortranname#,(f2py_init_func)#apiname#,doc_#apiname#},zE	{"#name#",-1,{{-1}},0,NULL,(f2py_init_func)#apiname#,doc_#apiname#},ZF_FUNCzR	fprintf(stderr,"debug-capi:Fortran subroutine `#fortranname#(#callfortran#)'\n");z4		if (#setjmpbuf#) {
			f2py_success = 0;
		} else {z			Py_BEGIN_ALLOW_THREADSz9				#callstatement#;
				/*(*f2py_func)(#callfortran#);*/z 				(*f2py_func)(#callfortran#);z			Py_END_ALLOW_THREADSz		})r   declfortranroutineroutine_defrl   rm   r   zFextern void #F_WRAPPEDFUNC#(#name_lower#,#NAME#)(#callprotoargument#);zm	{"#name#",-1,{{-1}},0,(char *)#F_WRAPPEDFUNC#(#name_lower#,#NAME#),(f2py_init_func)#apiname#,doc_#apiname#},a  
    {
      extern #ctype# #F_FUNC#(#name_lower#,#NAME#)(void);
      PyObject* o = PyDict_GetItemString(d,"#name#");
      PyObject_SetAttrString(o,"_cpointer", F2PyCapsule_FromVoidPtr((void*)#F_FUNC#(#name_lower#,#NAME#),NULL));
#if PY_VERSION_HEX >= 0x03000000
      PyObject_SetAttrString(o,"__name__", PyUnicode_FromString("#name#"));
#else
      PyObject_SetAttrString(o,"__name__", PyString_FromString("#name#"));
#endif
    }
    ZF_WRAPPEDFUNCzY	fprintf(stderr,"debug-capi:Fortran subroutine `f2pywrap#name_lower#(#callfortran#)'\n");z1	if (#setjmpbuf#) {
		f2py_success = 0;
	} else {z	Py_BEGIN_ALLOW_THREADSz	(*f2py_func)(#callfortran#);z3	#callstatement#;
	/*(*f2py_func)(#callfortran#);*/z	Py_END_ALLOW_THREADSz	})r   r   r   r   rl   rm   r   a  
    {
      extern void #F_FUNC#(#name_lower#,#NAME#)(void);
      PyObject* o = PyDict_GetItemString(d,"#name#");
      PyObject_SetAttrString(o,"_cpointer", F2PyCapsule_FromVoidPtr((void*)#F_FUNC#(#name_lower#,#NAME#),NULL));
#if PY_VERSION_HEX >= 0x03000000
      PyObject_SetAttrString(o,"__name__", PyUnicode_FromString("#name#"));
#else
      PyObject_SetAttrString(o,"__name__", PyString_FromString("#name#"));
#endif
    }
    z#ctype#z#rname#,z#pydocsignout#z"\item[]{{}\verb@#pydocsignout#@{}}z--- #resultnote#z#ifdef USESCOMPAQFORTRAN
	fprintf(stderr,"debug-capi:Fortran function #ctype# #fortranname#(#callcompaqfortran#)\n");
#else
	fprintf(stderr,"debug-capi:Fortran function #ctype# #fortranname#(#callfortran#)\n");
#endif
zW	fprintf(stderr,"debug-capi:Fortran function #ctype# #fortranname#(#callfortran#)\n");
)r   r   rt   rz   rm   r   zJextern #ctype# #F_FUNC#(#fortranname#,#FORTRANNAME#)(#callprotoargument#);z2extern #ctype# #fortranname#(#callprotoargument#);z#	#ctype# #name#_return_value={0,0};z	#ctype# #name#_return_value=0;z.	PyObject *#name#_return_value_capi = Py_None;zJ	#callstatement#;
/*	#name#_return_value = (*f2py_func)(#callfortran#);*/
z3	#name#_return_value = (*f2py_func)(#callfortran#);zV	fprintf(stderr,"#routdebugshowvalue#\n",#name#_return_value.r,#name#_return_value.i);z>	fprintf(stderr,"#routdebugshowvalue#\n",#name#_return_value);zE	#name#_return_value_capi = pyobj_from_#ctype#1(#name#_return_value);zpyobj_from_#ctype#1Z	long_longZlong_doublez	#rformat#z,#name#_return_value_capiz,#name#_return_value)	r   r   rL   rm   rQ   rl   r   r   r   z$	#ctype# #name#_return_value = NULL;z!	int #name#_return_value_len = 0;z,#name#_return_value,#name#_return_value_len,z%	#name#_return_value_len = #rlength#;z`	if ((#name#_return_value = (string)malloc(sizeof(char)*(#name#_return_value_len+1))) == NULL) {z6		PyErr_SetString(PyExc_MemoryError, "out of memory");z		f2py_success = 0;z		} else {z8		(#name#_return_value)[#name#_return_value_len] = '\0';z	if (f2py_success) {z		Py_BEGIN_ALLOW_THREADSzj#ifdef USESCOMPAQFORTRAN
		(*f2py_func)(#callcompaqfortran#);
#else
		(*f2py_func)(#callfortran#);
#endif
z		Py_END_ALLOW_THREADSzW		fprintf(stderr,"#routdebugshowvalue#\n",#name#_return_value_len,#name#_return_value);z/	} /* if (f2py_success) after (string)malloc */z!	STRINGFREE(#name#_return_value);Z
STRINGFREE)
r   r   rL   r~   rm   r   r   rS   rl   r   zZ	fprintf(stderr,"debug-capi:Python C/API function #modulename#.#name#(#docsignature#)\n");zW	fprintf(stderr,"debug-capi:Python C/API function #modulename#.#name#: successful.\n");zT	fprintf(stderr,"debug-capi:Python C/API function #modulename#.#name#: failure.\n");)rn   ro   rp   r   Zcomplex_long_doubleZunsigned_charZunsigned_shortZunsignedZunsigned_long_longrg   z.	/* Processing auxiliary variable #varname# */z$	fprintf(stderr,"#vardebuginfo#\n");z)	/* End of cleaning variable #varname# */)rM   rN   rl   z	#ctype# #varname# = 0;zmath.hz	#varname# = #init#;)rL   rl   rM   r   z
,#varname#z#outvarname#,z#varrformat#)r   rt   r   r   r   z	#ctype# #varname#;z0	#varname#.r = #init.r#, #varname#.i = #init.i#;)rL   rM   r   z	#ctype# #varname# = NULL;z	int slen(#varname#);zlen..)rL   rl   r   z	#ctype# *#varname# = NULL;z1	npy_intp #varname#_Dims[#rank#] = {#rank*[-1]#};z#	const int #varname#_Rank = #rank#;Zforcombr   )rl   r   _dependzflen(#varname#),string)r   rl   r   z$	/* Processing variable #varname# */)rM   rN   r   rl   z#pydocsign#z\item[]{{}\verb@#pydocsign#@{}}z--- See above.)rs   rr   rt   ry   rx   rz   Zdependz"#varname#",z
#varname#,)r|   r   r   z#varname#=#showinit#,)r}   r   r   r   )r   r   r   z#varname#_extra_args=(),z#varname#_extra_args,z=#varname#_extra_args : input tuple, optional\n    Default: ()z
#cbdocstr#z\item[] #cblatexdocstr#z}\item[]{{}\verb@#varname#_extra_args := () input tuple@{}} --- Extra arguments for call-back function {{}\verb@#varname#@{}}.z$	PyObject *#varname#_capi = Py_None;z)	PyTupleObject *#varname#_xa_capi = NULL;z+	PyTupleObject *#varname#_args_capi = NULL;z 	int #varname#_nofargs_capi = 0;z!	#cbname#_typedef #varname#_cptr;z"#varname#_extra_args",OzO!z,&#varname#_capiz!,&PyTuple_Type,&#varname#_xa_capiz(setjmp(#cbname#_jmpbuf))z#varname#_cptr,z#cbname#zsetjmp.h)r   r   rs   ru   r{   ry   rL   r   r   r   r   r   r   r   rq   r~   rl   r   zif(F2PyCapsule_Check(#varname#_capi)) {
  #varname#_cptr = F2PyCapsule_AsVoidPtr(#varname#_capi);
} else {
  #varname#_cptr = #cbname#;
}
a  if (#varname#_capi==Py_None) {
  #varname#_capi = PyObject_GetAttrString(#modulename#_module,"#varname#");
  if (#varname#_capi) {
    if (#varname#_xa_capi==NULL) {
      if (PyObject_HasAttrString(#modulename#_module,"#varname#_extra_args")) {
        PyObject* capi_tmp = PyObject_GetAttrString(#modulename#_module,"#varname#_extra_args");
        if (capi_tmp)
          #varname#_xa_capi = (PyTupleObject *)PySequence_Tuple(capi_tmp);
        else
          #varname#_xa_capi = (PyTupleObject *)Py_BuildValue("()");
        if (#varname#_xa_capi==NULL) {
          PyErr_SetString(#modulename#_error,"Failed to convert #modulename#.#varname#_extra_args to tuple.\n");
          return NULL;
        }
      }
    }
  }
  if (#varname#_capi==NULL) {
    PyErr_SetString(#modulename#_error,"Callback #varname# not defined (as an argument or module #modulename# attribute).\n");
    return NULL;
  }
}
a  	#varname#_nofargs_capi = #cbname#_nofargs;
	if (create_cb_arglist(#varname#_capi,#varname#_xa_capi,#maxnofargs#,#nofoptargs#,&#cbname#_nofargs,&#varname#_args_capi,"failed in processing argument list for call-back #varname#.")) {
		jmp_buf #varname#_jmpbuf;z		fprintf(stderr,"debug-capi:Assuming %d arguments; at most #maxnofargs#(-#nofoptargs#) is expected.\n",#cbname#_nofargs);
		CFUNCSMESSPY("for #varname#=",#cbname#_capi);zE		fprintf(stderr,"#vardebugshowvalue# (call-back in C).\n",#cbname#);z		CFUNCSMESS("Saving jmpbuf for `#varname#`.\n");
		SWAP(#varname#_capi,#cbname#_capi,PyObject);
		SWAP(#varname#_args_capi,#cbname#_args_capi,PyTupleObject);
		memcpy(&#varname#_jmpbuf,&#cbname#_jmpbuf,sizeof(jmp_buf));a  		CFUNCSMESS("Restoring jmpbuf for `#varname#`.\n");
		#cbname#_capi = #varname#_capi;
		Py_DECREF(#cbname#_args_capi);
		#cbname#_args_capi = #varname#_args_capi;
		#cbname#_nofargs = #varname#_nofargs_capi;
		memcpy(&#cbname#_jmpbuf,&#varname#_jmpbuf,sizeof(jmp_buf));
	}ZSWAPZcreate_cb_arglist)rM   rN   rl   r   r   z3	fprintf(stderr,"#vardebugshowvalue#\n",#varname#);z&#varname#,)rL   rQ   r~   r   r   )rl   r   zW	f2py_success = try_pyarr_from_#ctype#(#varname#_capi,&#varname#);
	if (f2py_success) {z/	} /*if (f2py_success) of #varname# pyobjfrom*/ztry_pyarr_from_#ctype#)	rL   r   r   r   r   rQ   rR   rl   r   z8	if (#varname#_capi == Py_None) #varname# = #init#; elser   z	if (#varname#_capi != Py_None)z		f2py_success = #ctype#_from_pyobj(&#varname#,#varname#_capi,"#pyname#() #nth# (#varname#) can't be converted to #ctype#");
	if (f2py_success) {z`		#varname# = (#ctype#)PyObject_IsTrue(#varname#_capi);
		f2py_success = 1;
	if (f2py_success) {z%	} /*if (f2py_success) of #varname#*/z#ctype#_from_pyobj)rM   rl   r   r   )rM   r   r   zA	fprintf(stderr,"#vardebugshowvalue#\n",#varname#.r,#varname#.i);z,#varname#_capi)rL   r~   rQ   r   r   zY		f2py_success = try_pyarr_from_#ctype#(#varname#_capi,&#varname#);
		if (f2py_success) {z0		} /*if (f2py_success) of #varname# pyobjfrom*/)	rL   r   r   r   r   rl   rQ   rR   r   zT	if (#varname#_capi==Py_None) {#varname#.r = #init.r#, #varname#.i = #init.i#;} elsez0	}  /*if (f2py_success) of #varname# frompyobj*/)rL   r   z1	#varname#_capi = pyobj_from_#ctype#1(#varname#);)rQ   rl   r   zslen(#varname#),zC	fprintf(stderr,"#vardebugshowvalue#\n",slen(#varname#),#varname#);)rL   r~   r   rQ   r   rl   r   z	slen(#varname#) = #length#;
	f2py_success = #ctype#_from_pyobj(&#varname#,&slen(#varname#),#init#,#varname#_capi,"#ctype#_from_pyobj failed in converting #nth# `#varname#' of #pyname# to C #ctype#");
	if (f2py_success) {z?		STRINGFREE(#varname#);
	}  /*if (f2py_success) of #varname#*/zV	f2py_success = try_pyarr_from_#ctype#(#varname#_capi,#varname#);
	if (f2py_success) {)r   r   r   r   rQ   rR   rl   r   z*	PyArrayObject *capi_#varname#_tmp = NULL;z	int capi_#varname#_intent = 0;z,capi_#varname#_tmp)rL   r~   r   rl   r   z"	int capi_overwrite_#varname# = 1;z"overwrite_#varname#",iz,&capi_overwrite_#varname#zoverwrite_#varname#=1,zoverwrite_#varname#,z9overwrite_#varname# : input int, optional\n    Default: 1)rL   r   r   r   r   r   rs   r   zH	capi_#varname#_intent |= (capi_overwrite_#varname#?0:F2PY_INTENT_COPY);z"	int capi_overwrite_#varname# = 0;zoverwrite_#varname#=0,z9overwrite_#varname# : input int, optional\n    Default: 0)rL   r   r   r   r   r   z	#setdims#;z#	capi_#varname#_intent |= #intent#;zl	capi_#varname#_tmp = array_from_pyobj(#atype#,#varname#_Dims,#varname#_Rank,capi_#varname#_intent,Py_None);zs	capi_#varname#_tmp = array_from_pyobj(#atype#,#varname#_Dims,#varname#_Rank,capi_#varname#_intent,#varname#_capi);z	if (capi_#varname#_tmp == NULL) {
		if (!PyErr_Occurred())
			PyErr_SetString(#modulename#_error,"failed in converting #nth# `#varname#' of #pyname# to C/Fortran array" );
	} else {
		#varname# = (#ctype# *)(PyArray_DATA(capi_#varname#_tmp));
z!	if (#varname#_capi == Py_None) {z	{z		#ctype# capi_c;a  		int *_i,capi_i=0;
		CFUNCSMESS("#name#: Initializing #varname#=#init#\n");
		if (initforcomb(PyArray_DIMS(capi_#varname#_tmp),PyArray_NDIM(capi_#varname#_tmp),1)) {
			while ((_i = nextforcomb()))
				#varname#[capi_i++] = #init#; /* fortran way */
		} else {
			if (!PyErr_Occurred())
				PyErr_SetString(#modulename#_error,"Initialization of #nth# #varname# failed (initforcomb).");
			f2py_success = 0;
		}
	}
	if (f2py_success) {z=	}  /*if (capi_#varname#_tmp == NULL) ... else of #varname#*/zY	if((PyObject *)capi_#varname#_tmp!=#varname#_capi) {
		Py_XDECREF(capi_#varname#_tmp); }z!		Py_XDECREF(capi_#varname#_tmp);z+	}  /*if (f2py_success) of #varname# init*/)rM   rN   r   r   z3	fprintf(stderr,"debug-capi:Checking `#check#'\n");)rM   rl   zN	CHECKSCALAR(#check#,"#check#","#nth# #varname#","#varshowvalue#",#varname#) {z	} /*CHECKSCALAR(#check#)*/ZCHECKSCALAR)rM   rN   rl   r   _breakzN	CHECKSTRING(#check#,"#check#","#nth# #varname#","#varshowvalue#",#varname#) {z	} /*CHECKSTRING(#check#)*/ZCHECKSTRINGZ
CHECKARRAYz2	CHECKARRAY(#check#,"#check#","#nth# #varname#") {z	} /*CHECKARRAY(#check#)*/)rl   rM   rN   r   r   ZCHECKGENERICz4	CHECKGENERIC(#check#,"#check#","#nth# #varname#") {z	} /*CHECKGENERIC(#check#)*/)rl   rM   rN   c             C   sb  t d| d   i }tdd }t| }tdti|}g }g }x| d D ]}d}	xJ| d D ]>}
|
d dksztd	 q`x"|
d D ]}|d |kr|}	P qW q`W |	std
|  qL|	g}d|	krxB|	d  D ]2\}}t	|	}|d= ||d< ||d< |
| qW xT|D ]L}	t|	\}}|rDt|	r:|
| n
|
| t||}t||}qW qLW t| \}}|r|
| t||}t||}t| \}}|r|
| t||}t||}x0|D ](}t|| d |d  }t||}qW t }i }xJ| D ]<}g ||< x*|| D ]}d}|tjkrLtj| }n|tjkrdtj| }n|tjkr|tj| }n|tjkrtj| }n|tjkrtj| }n|tjkrtj| }nt|tjkrtj| }n\|tjkrtj| }nD|tjkrtj| }n,|tjkr$tj| }ntdt|  q*|| 
| q*W qW |
| xF|D ]>}d|kr~|d | sd|krbt||| }t||}qbW tt |}t!j"#t$d |d }||d< t%|d}|&|d 'dd |(  t d| d |f  t$d rtt!j"#t$d |d d }t%|d}|&d |&d#|d  |(  t dt$d |d f  t$d  rt!j"#t$d |d d! }||d"< t%|d}|&d#t  d$t$kr|&d% |&d#|d&  d$t$kr|&d' |(  t d(t$d |d f  |r"t!j"#t$d |d) }||d*< t%|d}|&d+ |&d,t  |&d- g }xd.#|d )dD ]p}|r|d/ d0krx6t*|d1kr|
|dd1 d2  |d1d }qW |
|d  n|
|d  q~W d#|'d3d}|&| |(  t d4|  |r^t!j"#t$d d5|d  }||d*< t%|d}|&d6 |&d7t  |&d8 g }xd.#|d )dD ]}t*|d9kr|d/ d0kr|
|dd9 d:  |d9d }x6t*|d1kr|
|dd1 d:  |d1d }qW |
|d  n|
|d  qW d#|'d3d}|&| |(  t d;|  |S )<z
    Return
    z	Building module "%s"...
nameNf2py_versionZ
interfacedri   blockZ	interfacez1buildmodule: Expected interface block. Skipping.
zLbuildmodule: Could not found the body of interfaced routine "%s". Skipping.
entryargsZuserh   zbuildmodule: unknown need %s.
r   Z	buildpathZcoutputZcsrcwrf   	z  z&	Wrote C/API module "%s" to file "%s"
Z	dorestdoc
modulenamezmodule.restz.. -*- rest -*-
rd   r\   z8	ReST Documentation is saved to file "%s/%smodule.rest"
Z
dolatexdocz
module.texZltxz6%% This file is auto-generated with f2py (version:%s)
Z
shortlatexzO\documentclass{article}
\usepackage{a4wide}
\begin{document}
\tableofcontents

r[   z\end{document}z2	Documentation is saved to file "%s/%smodule.tex"
Zf2py_wrapper_outputZfsrczC     -*- fortran -*-
z8C     This file is autogenerated with f2py (version:%s)
z<C     It contains Fortran 77 wrappers to fortran functions.
z

r    B   z
     &z
     &
z'	Fortran 77 wrappers are saved to "%s"
z%s-f2pywrappers2.f90z!     -*- f90 -*-
z8!     This file is autogenerated with f2py (version:%s)
z<!     It contains Fortran 90 wrappers to fortran functions.
H   z&
     &z'	Fortran 90 wrappers are saved to "%s"
)+rC   defmod_rulesrF   Zmodsign2mapr   r   r   itemscopydeepcopyappendbuildapir.   r	   rH   Z
buildhooksrJ   rI   ZbuildusevarsrG   Z	get_needskeysrU   rV   rT   rW   rX   rY   rZ   rb   r`   reprmodule_rulesospathjoinoptionsopenwriterD   closesplitlen)mZumZretZ	mod_rulesvrdrdZfuncwrappersZfuncwrappers2nZnbZbibZnb_listkaZnb1ZapiwraparZcrZmruZneedscodecrfnfZwnlinesl r   /lib/python3.7/site-packages/numpy/f2py/rules.pybuildmodule  sD   

















"


















r   stZndr   Zth)
r                        	   r   c             C   sn  t | \} }t| \}}|t_| d }t| rJtd| d | d f  ntd| d   t| }ti |}x>t	D ]6}d|kr|d | sd|krtt
||| }t||}qtW d\}	}
i }x|D ]}t||| }t|| rt}ntt}t|| sVt|| s0|	d }	t|	t|	d	   d
 |d< n$|
d }
t|
t|
d	   d |d< nd|d< |||< xh|D ]`}d|kr~qld|kr|d || sd|krlt
|||| }t||}d|krlP qlW qW x|D ]}t|| rt}nt}|| }xh|D ]`}d|krqd|kr2|d || s<d|krt
|||| }t||}d|krP qW d|| krx8|| d D ](}||d< t
t||| }t||}qW qW t|d tr|d   t|d tr|d   ttd|d |d |d d|d< ttd|d |d d}|dkrVttdd|d i|d< ntd |d |d!|d< |d d"d#|d$< |d$ d%d&|d$< ttd'|d( |d) d*}t|d) dkrttd+|d( |d) d*|d,< n||d,< ||d(< t|d- tr$ttd.d-|d- id/ |d-< g |d0< g |d1< xd2D ]}||krlt|| trl|d0 ||  |d0< d3| }||kr:t|| tr:|d1 || d4d  d5g || dd   d6g |d1< q:W |d7 s|d8 r0|d9 }t|tr |d: n0t|ts tt|t|f|d9  d:7  < t
t|}t| rVtd;|d<   ntd=|d<   ||fS )>Nvarsz,			Constructing wrapper function "%s.%s"...
r   r   z(		Constructing wrapper function "%s"...
r   )r   r   r   r   z	 argumentnthz keywordZhiddenr   r   ZcheckrN   rR   z #docsign##docsignopt##docsignxa#r   r   r   )r   r   r   Zdocsignaturez#docsignopt##docsignxa#r   r   )r   r   rh   z	#docsign#Zdocsignatureshortz#docsign#[#docsignopt#])r   r   _z\_Zlatexdocsignatureshort,z, z #callfortran##callfortranappend#r~   r   )r~   r   z##callfortran# 0,#callfortranappend#Zcallcompaqfortranr   z#docreturn#z = rv   rw   )rr   rs   rt   ru   Zlatexr   z\begin{description}z\end{description}r   r   r   |z			  %s
rk   z		  %s
)rK   Zassubrr   rF   depargsr.   rC   Zroutsign2mapr   
rout_rulesr	   Zsign2mapr   	aux_rules	arg_rulesr#   r/   r   stndcheck_rules
isinstancelistreverserE   rD   r   r   strAssertionErrortyperoutine_rules)Zroutr   r   r   varr   r   r   r   r   ZnthkZsavevrdr   Z_rulesr   ZoptargsZcfsr   r   r   r   r   r   A  s    




&




&



,

r   )d__doc__Z
__future__r   r   r   r   rh   versionr   r   Ztimer   Zauxfuncsr	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   r   Zsepdictr   intenvirongetZgenerationtimeZasctimeZgmtimer   r   r   r   Ztypedef_need_dictr   r   r   r   r   r   r   r   r   r   <module>4   sP  
j
8
	



















	 8