(rout, um)
| 517 | |
| 518 | |
| 519 | def buildcallback(rout, um): |
| 520 | from . import capi_maps |
| 521 | |
| 522 | outmess(' Constructing call-back function "cb_%s_in_%s"\n' % |
| 523 | (rout['name'], um)) |
| 524 | args, depargs = getargs(rout) |
| 525 | capi_maps.depargs = depargs |
| 526 | var = rout['vars'] |
| 527 | vrd = capi_maps.cb_routsign2map(rout, um) |
| 528 | rd = dictappend({}, vrd) |
| 529 | cb_map[um].append([rout['name'], rd['name']]) |
| 530 | for r in cb_rout_rules: |
| 531 | if ('_check' in r and r['_check'](rout)) or ('_check' not in r): |
| 532 | ar = applyrules(r, vrd, rout) |
| 533 | rd = dictappend(rd, ar) |
| 534 | savevrd = {} |
| 535 | for i, a in enumerate(args): |
| 536 | vrd = capi_maps.cb_sign2map(a, var[a], index=i) |
| 537 | savevrd[a] = vrd |
| 538 | for r in cb_arg_rules: |
| 539 | if '_depend' in r: |
| 540 | continue |
| 541 | if '_optional' in r and isoptional(var[a]): |
| 542 | continue |
| 543 | if ('_check' in r and r['_check'](var[a])) or ('_check' not in r): |
| 544 | ar = applyrules(r, vrd, var[a]) |
| 545 | rd = dictappend(rd, ar) |
| 546 | if '_break' in r: |
| 547 | break |
| 548 | for a in args: |
| 549 | vrd = savevrd[a] |
| 550 | for r in cb_arg_rules: |
| 551 | if '_depend' in r: |
| 552 | continue |
| 553 | if ('_optional' not in r) or ('_optional' in r and isrequired(var[a])): |
| 554 | continue |
| 555 | if ('_check' in r and r['_check'](var[a])) or ('_check' not in r): |
| 556 | ar = applyrules(r, vrd, var[a]) |
| 557 | rd = dictappend(rd, ar) |
| 558 | if '_break' in r: |
| 559 | break |
| 560 | for a in depargs: |
| 561 | vrd = savevrd[a] |
| 562 | for r in cb_arg_rules: |
| 563 | if '_depend' not in r: |
| 564 | continue |
| 565 | if '_optional' in r: |
| 566 | continue |
| 567 | if ('_check' in r and r['_check'](var[a])) or ('_check' not in r): |
| 568 | ar = applyrules(r, vrd, var[a]) |
| 569 | rd = dictappend(rd, ar) |
| 570 | if '_break' in r: |
| 571 | break |
| 572 | if 'args' in rd and 'optargs' in rd: |
| 573 | if isinstance(rd['optargs'], list): |
| 574 | rd['optargs'] = rd['optargs'] + [""" |
| 575 | #ifndef F2PY_CB_RETURNCOMPLEX |
| 576 | , |
no test coverage detected