MCPcopy Index your code
hub / github.com/numpy/numpy / cb_routsign2map

Function cb_routsign2map

numpy/f2py/capi_maps.py:714–788  ·  view source on GitHub ↗

name,begintitle,endtitle,argname ctype,rctype,maxnofargs,nofoptargs,returncptr

(rout, um)

Source from the content-addressed store, hash-verified

712
713
714def cb_routsign2map(rout, um):
715 """
716 name,begintitle,endtitle,argname
717 ctype,rctype,maxnofargs,nofoptargs,returncptr
718 """
719 ret = {'name': f"cb_{rout['name']}_in_{um}",
720 'returncptr': ''}
721 if isintent_callback(rout):
722 if '_' in rout['name']:
723 F_FUNC = 'F_FUNC_US'
724 else:
725 F_FUNC = 'F_FUNC'
726 ret['callbackname'] = f"{F_FUNC}({rout['name'].lower()},{rout['name'].upper()})"
727 ret['static'] = 'extern'
728 else:
729 ret['callbackname'] = ret['name']
730 ret['static'] = 'static'
731 ret['argname'] = rout['name']
732 ret['begintitle'] = gentitle(ret['name'])
733 ret['endtitle'] = gentitle(f"end of {ret['name']}")
734 ret['ctype'] = getctype(rout)
735 ret['rctype'] = 'void'
736 if ret['ctype'] == 'string':
737 ret['rctype'] = 'void'
738 else:
739 ret['rctype'] = ret['ctype']
740 if ret['rctype'] != 'void':
741 if iscomplexfunction(rout):
742 ret['returncptr'] = """
743#ifdef F2PY_CB_RETURNCOMPLEX
744return_value=
745#endif
746"""
747 else:
748 ret['returncptr'] = 'return_value='
749 if ret['ctype'] in cformat_map:
750 ret['showvalueformat'] = f"{cformat_map[ret['ctype']]}"
751 if isstringfunction(rout):
752 ret['strlength'] = getstrlength(rout)
753 if isfunction(rout):
754 if 'result' in rout:
755 a = rout['result']
756 else:
757 a = rout['name']
758 if hasnote(rout['vars'][a]):
759 ret['note'] = rout['vars'][a]['note']
760 rout['vars'][a]['note'] = ['See elsewhere.']
761 ret['rname'] = a
762 ret['pydocsign'], ret['pydocsignout'] = getpydocsign(a, rout)
763 if iscomplexfunction(rout):
764 ret['rctype'] = """
765#ifdef F2PY_CB_RETURNCOMPLEX
766#ctype#
767#else
768void
769#endif
770"""
771 elif hasnote(rout):

Callers

nothing calls this directly

Calls 13

isintent_callbackFunction · 0.85
gentitleFunction · 0.85
getctypeFunction · 0.85
iscomplexfunctionFunction · 0.85
isstringfunctionFunction · 0.85
getstrlengthFunction · 0.85
hasnoteFunction · 0.85
getpydocsignFunction · 0.85
l_orFunction · 0.85
isoptionalFunction · 0.85
lowerMethod · 0.80
upperMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…