(rout, signature=0)
| 76 | return useisoc |
| 77 | |
| 78 | def createfuncwrapper(rout, signature=0): |
| 79 | assert isfunction(rout) |
| 80 | |
| 81 | extra_args = [] |
| 82 | vars = rout['vars'] |
| 83 | for a in rout['args']: |
| 84 | v = rout['vars'][a] |
| 85 | for i, d in enumerate(v.get('dimension', [])): |
| 86 | if d == ':': |
| 87 | dn = 'f2py_%s_d%s' % (a, i) |
| 88 | dv = dict(typespec='integer', intent=['hide']) |
| 89 | dv['='] = 'shape(%s, %s)' % (a, i) |
| 90 | extra_args.append(dn) |
| 91 | vars[dn] = dv |
| 92 | v['dimension'][i] = dn |
| 93 | rout['args'].extend(extra_args) |
| 94 | need_interface = bool(extra_args) |
| 95 | |
| 96 | ret = [''] |
| 97 | |
| 98 | def add(line, ret=ret): |
| 99 | ret[0] = '%s\n %s' % (ret[0], line) |
| 100 | name = rout['name'] |
| 101 | fortranname = getfortranname(rout) |
| 102 | f90mode = ismoduleroutine(rout) |
| 103 | newname = '%sf2pywrap' % (name) |
| 104 | |
| 105 | if newname not in vars: |
| 106 | vars[newname] = vars[name] |
| 107 | args = [newname] + rout['args'][1:] |
| 108 | else: |
| 109 | args = [newname] + rout['args'] |
| 110 | |
| 111 | l_tmpl = var2fixfortran(vars, name, '@@@NAME@@@', f90mode) |
| 112 | if l_tmpl[:13] == 'character*(*)': |
| 113 | if f90mode: |
| 114 | l_tmpl = 'character(len=10)' + l_tmpl[13:] |
| 115 | else: |
| 116 | l_tmpl = 'character*10' + l_tmpl[13:] |
| 117 | charselect = vars[name]['charselector'] |
| 118 | if charselect.get('*', '') == '(*)': |
| 119 | charselect['*'] = '10' |
| 120 | |
| 121 | l1 = l_tmpl.replace('@@@NAME@@@', newname) |
| 122 | rl = None |
| 123 | |
| 124 | useisoc = useiso_c_binding(rout) |
| 125 | sargs = ', '.join(args) |
| 126 | if f90mode: |
| 127 | # gh-23598 fix warning |
| 128 | # Essentially, this gets called again with modules where the name of the |
| 129 | # function is added to the arguments, which is not required, and removed |
| 130 | sargs = sargs.replace(f"{name}, ", '') |
| 131 | args = [arg for arg in args if arg != name] |
| 132 | rout['args'] = args |
| 133 | add('subroutine f2pywrap_%s_%s (%s)' % |
| 134 | (rout['modulename'], name, sargs)) |
| 135 | if not signature: |
no test coverage detected