MCPcopy Create free account
hub / github.com/numpy/numpy / buildhooks

Function buildhooks

numpy/f2py/f90mod_rules.py:82–264  ·  view source on GitHub ↗
(pymod)

Source from the content-addressed store, hash-verified

80
81
82def buildhooks(pymod):
83 from . import rules
84 ret = {'f90modhooks': [], 'initf90modhooks': [], 'body': [],
85 'need': ['F_FUNC', 'arrayobject.h'],
86 'separatorsfor': {'includes0': '\n', 'includes': '\n'},
87 'docs': ['"Fortran 90/95 modules:\\n"'],
88 'latexdoc': []}
89 fhooks = ['']
90
91 def fadd(line, s=fhooks):
92 s[0] = '%s\n %s' % (s[0], line)
93 doc = ['']
94
95 def dadd(line, s=doc):
96 s[0] = '%s\n%s' % (s[0], line)
97
98 usenames = getuseblocks(pymod)
99 for m in findf90modules(pymod):
100 sargs, fargs, efargs, modobjs, notvars, onlyvars = [], [], [], [], [
101 m['name']], []
102 sargsp = []
103 ifargs = []
104 mfargs = []
105 if hasbody(m):
106 for b in m['body']:
107 notvars.append(b['name'])
108 for n in m['vars'].keys():
109 var = m['vars'][n]
110 if (n not in notvars) and (not l_or(isintent_hide, isprivate)(var)):
111 onlyvars.append(n)
112 mfargs.append(n)
113 outmess('\t\tConstructing F90 module support for "%s"...\n' %
114 (m['name']))
115 if m['name'] in usenames and not onlyvars:
116 outmess(f"\t\t\tSkipping {m['name']} since it is in 'use'...\n")
117 continue
118 if onlyvars:
119 outmess('\t\t Variables: %s\n' % (' '.join(onlyvars)))
120 chooks = ['']
121
122 def cadd(line, s=chooks):
123 s[0] = '%s\n%s' % (s[0], line)
124 ihooks = ['']
125
126 def iadd(line, s=ihooks):
127 s[0] = '%s\n%s' % (s[0], line)
128
129 vrd = capi_maps.modsign2map(m)
130 cadd('static FortranDataDef f2py_%s_def[] = {' % (m['name']))
131 dadd('\\subsection{Fortran 90/95 module \\texttt{%s}}\n' % (m['name']))
132 if hasnote(m):
133 note = m['note']
134 if isinstance(note, list):
135 note = '\n'.join(note)
136 dadd(note)
137 if onlyvars:
138 dadd('\\begin{description}')
139 for n in onlyvars:

Callers

nothing calls this directly

Calls 15

getuseblocksFunction · 0.85
findf90modulesFunction · 0.85
hasbodyFunction · 0.85
l_orFunction · 0.85
hasnoteFunction · 0.85
undo_rmbadname1Function · 0.85
isallocatableFunction · 0.85
isroutineFunction · 0.85
applyrulesFunction · 0.85
dictappendFunction · 0.85
undo_rmbadnameFunction · 0.85
keysMethod · 0.80

Tested by

no test coverage detected