name,begintitle,endtitle,argname ctype,rctype,maxnofargs,nofoptargs,returncptr
(rout, um)
| 712 | |
| 713 | |
| 714 | def 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 |
| 744 | return_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 |
| 768 | void |
| 769 | #endif |
| 770 | """ |
| 771 | elif hasnote(rout): |
nothing calls this directly
no test coverage detected
searching dependent graphs…