(namespace, data)
| 459 | |
| 460 | |
| 461 | def outputinterfaces(namespace, data): |
| 462 | lastclass = '' |
| 463 | lastmethod = '' |
| 464 | for method in data['methods']: |
| 465 | if (len(method) > 0): |
| 466 | returntype = converttype(method['returntype']) |
| 467 | if(method['returntype'][len(method['returntype']) - 1] == '*'): |
| 468 | # Native methods which return pointers are cast to IntPtr |
| 469 | returntype = 'IntPtr' |
| 470 | |
| 471 | methodname = method['methodname'] |
| 472 | if(methodname == lastmethod): |
| 473 | methodname = methodname + repr(count) |
| 474 | count = count + 1 |
| 475 | else: |
| 476 | count = 0 |
| 477 | lastmethod = method['methodname'] |
| 478 | |
| 479 | classname = method['classname'] |
| 480 | |
| 481 | if(namespace != getnamespace(classname)): |
| 482 | continue |
| 483 | |
| 484 | classname = getclasswithoutnamespace(classname) |
| 485 | if(classname != lastclass): |
| 486 | if(lastclass != ''): |
| 487 | print("\t}\n"); |
| 488 | |
| 489 | print("\t[StructLayout(LayoutKind.Sequential)]") |
| 490 | print("\tpublic struct " + classname + "\n\t{") |
| 491 | lastclass = classname |
| 492 | |
| 493 | |
| 494 | paramlist = [] |
| 495 | if('params' in method): |
| 496 | for param in method['params']: |
| 497 | paramtype = converttype(param['paramtype']) |
| 498 | if(param['paramtype'][len(param['paramtype']) - 1] == '*' and param['paramtype'][len(param['paramtype']) - 2] == '*'): |
| 499 | paramlist.append('ref ' + paramtype + ' ' + param['paramname']) |
| 500 | elif(param['paramtype'][len(param['paramtype']) - 1] == '*'): |
| 501 | if('out_array_count' in param) or ('array_call' in param) or ('array_count' in param) or ('out_array_call' in param): |
| 502 | paramlist.append('[In, Out] ' + paramtype + '[] ' + param['paramname']) |
| 503 | elif('out_string_count' in param): |
| 504 | paramlist.append('System.Text.StringBuilder ' + param['paramname']) |
| 505 | elif('out_struct' in param): |
| 506 | paramlist.append('ref '+ paramtype +' ' + param['paramname']) |
| 507 | elif('out_string' in param): |
| 508 | paramlist.append('System.Text.StringBuilder ' + param['paramname']) |
| 509 | # elif(structlist.has_key(paramtype)): |
| 510 | # paramlist.append(paramtype+' ' + param['paramname']) |
| 511 | # elif(paramtype[0:1] == 'I' and paramtype != 'IntPtr'): |
| 512 | # paramlist.append('IntPtr ' + param['paramname']) |
| 513 | elif (paramtype == 'uint' or paramtype == 'int' or paramtype == 'char' or paramtype == 'bool'): |
| 514 | # Output params for ints,uints,char |
| 515 | paramlist.append('ref ' + paramtype + ' ' + param['paramname']) |
| 516 | elif (paramtype == 'string' and param['paramtype'] == 'const char *'): |
| 517 | # Managed strings on Windows need to be converted to Utf8 native ptrs |
| 518 | paramlist.append('IntPtr ' + param['paramname']) |
nothing calls this directly
no test coverage detected