Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 9827b5b in mainline


Ignore:
Timestamp:
2014-09-08T20:50:05Z (6 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
master
Children:
5301662
Parents:
b8f433e
Message:

Generate additional #defines for each autogenerated structure.

For each member, generate a #define describing its size. If the member
is an array (i.e. it has the 'elements' key defined), define also
the size of one item.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/autogen.py

    rb8f433e r9827b5b  
    6969                    (struct['name'].upper(), member['name'].upper(), struct['name'],
    7070                    member['name']))
     71                code = code + ("\temit_constant(%s_SIZE_%s, sizeof(((%s_t *) 0)->%s));\n" %
     72                    (struct['name'].upper(), member['name'].upper(), struct['name'],
     73                    member['name']))
     74                if 'elements' in member.keys():
     75                        code = code + ("\temit_constant(%s_%s_ITEM_SIZE, sizeof(%s));\n" %
     76                            (struct['name'].upper(), member['name'].upper(), member['type']))
     77                       
    7178        return code
    7279
Note: See TracChangeset for help on using the changeset viewer.