(struct, data)
| 313 | print('}') |
| 314 | |
| 315 | def outputstructfields(struct, data): |
| 316 | |
| 317 | # recursively add base class fields first |
| 318 | basename = getclasswithoutnamespace(struct['struct']) |
| 319 | if basename in structparents: |
| 320 | parentname = structparents[basename] |
| 321 | i = structindices[parentname]; |
| 322 | outputstructfields(data['structs'][i], data) |
| 323 | |
| 324 | for enumvalue in struct['fields']: |
| 325 | fieldtype = enumvalue['fieldtype'] |
| 326 | otype = converttype(fieldtype) |
| 327 | lastchar = fieldtype[len(fieldtype) - 1] |
| 328 | if(lastchar == ']'): |
| 329 | #print('\tpublic fixed '+otype+' '+enumvalue['fieldname']+ fieldtype[fieldtype.find('['):]+';') |
| 330 | dims = map(int, fieldtype[fieldtype.find('[')+1:-1].split('][')) |
| 331 | size = reduce(operator.mul, dims, 1) |
| 332 | utype = unmanagedtype(otype) |
| 333 | if(otype == 'char'): |
| 334 | #print('\t[MarshalAs(UnmanagedType.ByValTStr, SizeConst = '+str(size)+')]') |
| 335 | sys.stdout.write('public byte '+enumvalue['fieldname']+'0') |
| 336 | for i in range(1, size): |
| 337 | sys.stdout.write(',' + enumvalue['fieldname'] + str(i)) |
| 338 | print(';') |
| 339 | |
| 340 | |
| 341 | print('public string ' + enumvalue['fieldname'] + '\n{') |
| 342 | print('get\n{') |
| 343 | print('return new string(new char[] {') |
| 344 | for i in range(0, size-1): |
| 345 | print('(char)' + enumvalue['fieldname'] + str(i) + ',') |
| 346 | print('(char)' + enumvalue['fieldname'] + str(size-1) + '}).TrimEnd(\'\\0\');') |
| 347 | print('}') |
| 348 | print('}') |
| 349 | else: |
| 350 | #print('\t[MarshalAs(UnmanagedType.ByValArray, SizeConst = '+str(size)+', ArraySubType = UnmanagedType.'+utype+')]') |
| 351 | for i in range(size): |
| 352 | print('\tpublic '+otype+' '+enumvalue['fieldname']+str(i)+';'+(' //'+otype+fieldtype[fieldtype.find('['):] if(i==0) else '')) |
| 353 | else: |
| 354 | if(otype == 'bool'): print('\t[MarshalAs(UnmanagedType.I1)]') |
| 355 | if(lastchar == '*'): |
| 356 | print('\tpublic IntPtr '+enumvalue['fieldname']+';'+' // '+fieldtype) |
| 357 | else: |
| 358 | print('\tpublic '+otype+' '+enumvalue['fieldname']+';') |
| 359 | |
| 360 | def outputstructs(namespace, data): |
| 361 | for struct in data['structs']: |
no test coverage detected