[build] Move settings generation from Python to Rust code;

This commit is contained in:
Benjamin Bouvier
2018-11-21 15:38:12 +01:00
committed by Dan Gohman
parent 4c8f1e7a5a
commit d94e027c2a
20 changed files with 1334 additions and 40 deletions

View File

@@ -340,7 +340,7 @@ class SettingGroup(object):
precomputed predicates.
This is the size of the byte-sized settings plus all the numbered
predcate bits rounded up to a whole number of bytes.
predicate bits rounded up to a whole number of bytes.
"""
return self.boolean_offset + (len(self.predicate_number) + 7) // 8

View File

@@ -255,8 +255,8 @@ def gen_display(sgrp, fmt):
fmt.line('Ok(())')
def gen_constructor(sgrp, parent, fmt):
# type: (SettingGroup, PredContext, srcgen.Formatter) -> None
def gen_constructor(sgrp, fmt):
# type: (SettingGroup, srcgen.Formatter) -> None
"""
Generate a Flags constructor.
"""
@@ -310,7 +310,7 @@ def gen_group(sgrp, fmt):
with fmt.indented('pub struct Flags {', '}'):
fmt.line('bytes: [u8; {}],'.format(sgrp.byte_size()))
gen_constructor(sgrp, None, fmt)
gen_constructor(sgrp, fmt)
gen_enum_types(sgrp, fmt)
gen_getters(sgrp, fmt)
gen_descriptors(sgrp, fmt)