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

Function f2cexpr

numpy/f2py/capi_maps.py:238–250  ·  view source on GitHub ↗

Rewrite Fortran expression as f2py supported C expression. Due to the lack of a proper expression parser in f2py, this function uses a heuristic approach that assumes that Fortran arithmetic expressions are valid C arithmetic expressions when mapping Fortran function calls to the co

(expr)

Source from the content-addressed store, hash-verified

236
237
238def f2cexpr(expr):
239 """Rewrite Fortran expression as f2py supported C expression.
240
241 Due to the lack of a proper expression parser in f2py, this
242 function uses a heuristic approach that assumes that Fortran
243 arithmetic expressions are valid C arithmetic expressions when
244 mapping Fortran function calls to the corresponding C function/CPP
245 macros calls.
246
247 """
248 # TODO: support Fortran `len` function with optional kind parameter
249 expr = re.sub(r'\blen\b', 'f2py_slen', expr)
250 return expr
251
252
253def getstrlength(var):

Callers 1

getstrlengthFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected