()
| 957 | # Emit the whole output file. |
| 958 | # |
| 959 | def emit_config(): |
| 960 | out = open(sys.argv[1], 'w'); |
| 961 | |
| 962 | out.write(header); |
| 963 | |
| 964 | out.write("struct OffsetsForDebug {\n") |
| 965 | for (klass, field, offset) in offsetof_fields: |
| 966 | out.write(" static const int %s_%s = %s;\n" % (klass, field, offset)) |
| 967 | out.write("};\n") |
| 968 | |
| 969 | out.write('/* miscellaneous constants */\n'); |
| 970 | emit_constants(out, consts_misc); |
| 971 | |
| 972 | out.write('/* class type information */\n'); |
| 973 | consts = []; |
| 974 | for typename in sorted(typeclasses): |
| 975 | klass = typeclasses[typename]; |
| 976 | consts.append({ |
| 977 | 'name': 'type_%s__%s' % (klass, typename), |
| 978 | 'value': typename |
| 979 | }); |
| 980 | |
| 981 | emit_constants(out, consts); |
| 982 | |
| 983 | out.write('/* class hierarchy information */\n'); |
| 984 | consts = []; |
| 985 | for klassname in sorted(klasses): |
| 986 | pklass = klasses[klassname]['parent']; |
| 987 | if (klassname == pklass): |
| 988 | continue |
| 989 | bklass = get_base_class(klassname); |
| 990 | if (bklass != 'Object'): |
| 991 | continue; |
| 992 | if (pklass is None): |
| 993 | continue; |
| 994 | |
| 995 | consts.append({ |
| 996 | 'name': 'parent_%s__%s' % (klassname, pklass), |
| 997 | 'value': 0 |
| 998 | }); |
| 999 | |
| 1000 | emit_constants(out, consts); |
| 1001 | |
| 1002 | out.write('/* field information */\n'); |
| 1003 | emit_constants(out, fields); |
| 1004 | |
| 1005 | out.write(footer); |
| 1006 | |
| 1007 | if (len(sys.argv) < 4): |
| 1008 | print('usage: %s output.cc objects.h objects-inl.h' % sys.argv[0]); |
no test coverage detected