|
14 | 14 |
|
15 | 15 | from . import objects, logging, crep, output, ctree, serialize, structure |
16 | 16 | from . import traits |
17 | | -from . import breaking_changes as compat |
| 17 | +from . import breaking_changes |
18 | 18 | import dml.globals |
19 | 19 | from .structure import get_attr_name, port_class_ident, need_port_proxy_attrs |
20 | 20 | from .logging import * |
@@ -261,7 +261,7 @@ def generate_hfile(device, headers, filename): |
261 | 261 | out("/* Generated by dmlc, do not edit! */\n\n") |
262 | 262 | emit_guard_start(filename) |
263 | 263 | out('#define DML_PREFIX(x) '+crep.cname(device)+'_##x\n\n') |
264 | | - legacy_attrs = int(compat.legacy_attributes in dml.globals.enabled_compat) |
| 264 | + legacy_attrs = int(not breaking_changes.remove_legacy_attributes.enabled()) |
265 | 265 | out(f'#define DML_LEGACY_ATTRS {legacy_attrs}\n') |
266 | 266 |
|
267 | 267 | with allow_linemarks(): |
@@ -893,7 +893,7 @@ def generate_implement(code, device, impl): |
893 | 893 | # descendants of the device object |
894 | 894 | if (port.parent is dml.globals.device |
895 | 895 | and port.objtype in {'port', 'bank'} |
896 | | - and compat.port_proxy_ifaces in dml.globals.enabled_compat): |
| 896 | + and not breaking_changes.remove_port_proxy_ifaces.enabled()): |
897 | 897 | if port.local_dimensions() == 0: |
898 | 898 | code.out("static const %s = %s;\n" % ( |
899 | 899 | ifacetype.declaration('port_iface'), |
@@ -1684,7 +1684,7 @@ def generate_pre_delete(device): |
1684 | 1684 | + 'NULL);\n') |
1685 | 1685 | out('}\n', preindent=-1) |
1686 | 1686 |
|
1687 | | - if dml.globals.api_version < compat.api_7: |
| 1687 | + if dml.globals.api_version < breaking_changes.api_7: |
1688 | 1688 | out(f'{crep.cname(device)}_deinit(_obj);\n') |
1689 | 1689 | out('}\n\n', preindent = -1) |
1690 | 1690 |
|
@@ -1938,7 +1938,7 @@ def generate_init_data_objs(device): |
1938 | 1938 | for (start, end) in [('A', 'Z'), ('a', 'z'), ('0', '9'), ('_', '_')] |
1939 | 1939 | for i in range(ord(start), ord(end) + 1)) |
1940 | 1940 | def init_function_name(device, outprefix): |
1941 | | - if dml.globals.api_version <= compat.api_4_8: |
| 1941 | + if dml.globals.api_version <= breaking_changes.api_4_8: |
1942 | 1942 | return 'initialize_' + crep.cname(device) |
1943 | 1943 | return '_initialize_' + ''.join( |
1944 | 1944 | (ch if ch in ident_chars else '_') for ch in outprefix) |
@@ -1966,7 +1966,7 @@ def generate_init(device, initcode, outprefix): |
1966 | 1966 | out('.init = '+crep.cname(device)+'_init,\n') |
1967 | 1967 | out('.finalize = '+crep.cname(device)+'_finalize,\n') |
1968 | 1968 | out('.objects_finalized = '+crep.cname(device)+'_objects_finalized,\n') |
1969 | | - if dml.globals.api_version >= compat.api_7: |
| 1969 | + if dml.globals.api_version >= breaking_changes.api_7: |
1970 | 1970 | out('.deinit = '+crep.cname(device)+'_deinit,\n') |
1971 | 1971 | out('.dealloc = '+crep.cname(device)+'_dealloc,\n') |
1972 | 1972 | out('.description = '+doc.read()+',\n') |
@@ -2166,7 +2166,7 @@ def generate_port_object_assocs_array(): |
2166 | 2166 | else node.object_parent) |
2167 | 2167 | if (object_node is not dml.globals.device |
2168 | 2168 | # Anonymous banks |
2169 | | - and (compat.dml12_misc not in dml.globals.enabled_compat |
| 2169 | + and (breaking_changes.remove_misc_quirks.enabled() |
2170 | 2170 | or object_node.ident is not None)): |
2171 | 2171 | port_obj_offset = ( |
2172 | 2172 | f'offsetof({crep.structtype(dml.globals.device)}, ' |
@@ -3276,8 +3276,9 @@ def generate_cfile(device, footers, |
3276 | 3276 | full_module): |
3277 | 3277 | global c_file |
3278 | 3278 |
|
3279 | | - sym = 'SIMICS_%s_API' % ('4_8' if dml.globals.api_version == compat.api_4_8 |
3280 | | - else dml.globals.api_version.str) |
| 3279 | + sym = 'SIMICS_%s_API' % ( |
| 3280 | + '4_8' if dml.globals.api_version == breaking_changes.api_4_8 |
| 3281 | + else dml.globals.api_version.str) |
3281 | 3282 | api_define = '#ifndef %s\n#define %s\n#endif\n' % ( |
3282 | 3283 | sym, sym) |
3283 | 3284 |
|
@@ -3336,8 +3337,8 @@ def generate_cfile_body(device, footers, full_module, filename_prefix): |
3336 | 3337 | generate_events(device) |
3337 | 3338 | generate_identity_data_decls() |
3338 | 3339 | generate_object_vtables_array() |
3339 | | - if not (dml.globals.dml_version == (1, 2) |
3340 | | - and compat.shared_logs_on_device in dml.globals.enabled_compat): |
| 3340 | + if (dml.globals.dml_version != (1, 2) |
| 3341 | + or breaking_changes.shared_logs_locally.enabled()): |
3341 | 3342 | generate_port_object_assocs_array() |
3342 | 3343 | generate_class_var_decl() |
3343 | 3344 | generate_startup_calls_entry_function(device) |
@@ -3470,7 +3471,7 @@ def generate_cfile_body(device, footers, full_module, filename_prefix): |
3470 | 3471 |
|
3471 | 3472 | if full_module: |
3472 | 3473 | # caught as error earlier on |
3473 | | - assert dml.globals.api_version == compat.api_4_8 |
| 3474 | + assert dml.globals.api_version == breaking_changes.api_4_8 |
3474 | 3475 | out('\n') |
3475 | 3476 | out('EXPORTED void\n') |
3476 | 3477 | out('init_local(void)\n') |
|
0 commit comments