| 1 | /****************************************************************************** |
| 2 | * Genevent |
| 3 | * |
| 4 | * Event generator. XML to logging C code converter. |
| 5 | * |
| 6 | * Supports : |
| 7 | * - C Alignment |
| 8 | * - C types : struct, union, enum, basic types. |
| 9 | * - Architectures : LP32, ILP32, ILP64, LLP64, LP64. |
| 10 | * |
| 11 | * Additionnal structures supported : |
| 12 | * - embedded variable size strings |
| 13 | * - embedded variable size arrays |
| 14 | * - embedded variable size sequences |
| 15 | * |
| 16 | * Notes : |
| 17 | * (1) |
| 18 | * enums are limited to integer type, as this is what is used in C. Note, |
| 19 | * however, that ISO/IEC 9899:TC2 specify that the type of enum can be char, |
| 20 | * unsigned int or int. This is implementation defined (compiler). That's why we |
| 21 | * add a check for sizeof enum. |
| 22 | * |
| 23 | * (2) |
| 24 | * Because of archtecture defined type sizes, we need to ask for ltt_align |
| 25 | * (which gives the alignment) by passing basic types, not their actual sizes. |
| 26 | * It's up to ltt_align to determine sizes of types. |
| 27 | * |
| 28 | * Note that, from |
| 29 | * http://www.usenix.org/publications/login/standards/10.data.html |
| 30 | * (Andrew Josey <a.josey@opengroup.org>) : |
| 31 | * |
| 32 | * Data Type LP32 ILP32 ILP64 LLP64 LP64 |
| 33 | * char 8 8 8 8 8 |
| 34 | * short 16 16 16 16 16 |
| 35 | * int32 32 |
| 36 | * int 16 32 64 32 32 |
| 37 | * long 32 32 64 32 64 |
| 38 | * long long (int64) 64 |
| 39 | * pointer 32 32 64 64 64 |
| 40 | * |
| 41 | * With these constraints : |
| 42 | * sizeof(char) <= sizeof(short) <= sizeof(int) |
| 43 | * <= sizeof(long) = sizeof(size_t) |
| 44 | * |
| 45 | * and therefore sizeof(long) <= sizeof(pointer) <= sizeof(size_t) |
| 46 | * |
| 47 | * Which means we only have to remember which is the biggest type in a structure |
| 48 | * to know the structure's alignment. |
| 49 | */ |
| 50 | |
| 51 | |
| 52 | |
| 53 | /* Code printing */ |
| 54 | |
| 55 | /* Type size checking */ |
| 56 | int print_check(int fd); |
| 57 | |
| 58 | |
| 59 | /* Print types */ |
| 60 | int print_types(int fd); |
| 61 | |
| 62 | /* Print events */ |
| 63 | int print_events(int fd); |
| 64 | |
| 65 | |
| 66 | |