@@ -295,19 +295,42 @@ def _dump_server_class_table(table, open_file, level=1, offset=0):
295295 new_table , open_file , level + 1 , new_offset )
296296
297297 # Was there an offset passed?
298- elif offset :
298+ else :
299+ real_prop_type = _get_real_prop_type (prop )
299300
300- # Write the property and its values to file
301- open_file .write ('{0}{1} {2} (offset {3} - {4})\n ' .format (
302- ' ' * level , prop .type , prop .name ,
303- prop .offset , prop .offset + offset ))
301+ if offset :
304302
305- # Was no offset passed?
306- else :
303+ # Write the property and its values to file
304+ open_file .write ('{0}{1} {2} (offset {3} - {4})\n ' .format (
305+ ' ' * level , real_prop_type , prop .name ,
306+ prop .offset , prop .offset + offset ))
307+
308+ # Was no offset passed?
309+ else :
310+
311+ # Write the property and its values to file
312+ open_file .write ('{0}{1} {2} (offset {3})\n ' .format (
313+ ' ' * level , real_prop_type , prop .name , prop .offset ))
314+
315+ def _get_real_prop_type (prop ):
316+ """Return the real property type name of the given prop."""
317+ if prop .type != SendPropType .INT :
318+ return str (prop .type )
319+
320+ bit_count = prop .bits
321+ if bit_count < 1 :
322+ return str (prop .type )
323+
324+ if bit_count >= 17 :
325+ return 'INT'
326+
327+ if bit_count >= 9 :
328+ return '{}SHORT' .format ('' if prop .is_signed () else 'U' )
329+
330+ if bit_count >= 2 :
331+ return '{}CHAR' .format ('' if prop .is_signed () else 'U' )
307332
308- # Write the property and its values to file
309- open_file .write ('{0}{1} {2} (offset {3})\n ' .format (
310- ' ' * level , prop .type , prop .name , prop .offset ))
333+ return 'BOOL'
311334
312335
313336# =============================================================================
0 commit comments