Revert "progress: not generating unused bits into C header"

This reverts commit 3d5fd43f7d.
This commit is contained in:
Andrey 2022-11-28 20:50:45 -05:00
parent 3d5fd43f7d
commit 4d9a0500d4
4 changed files with 94 additions and 4 deletions

Binary file not shown.

View File

@ -11,9 +11,6 @@ public class BaseCHeaderConsumer implements ConfigurationConsumer {
private static String getHeaderText(FieldIteratorWithOffset iterator) {
ConfigField configField = iterator.cf;
if (configField.isBit()) {
if (configField.getName().startsWith(ConfigStructure.UNUSED_ANYTHING_PREFIX)) {
return "";
}
String comment = "\t/**" + EOL + packComment(configField.getCommentContent(), "\t") + "\toffset " + iterator.currentOffset + " bit " + iterator.bitState.get() + " */" + EOL;
return comment + "\t" + BOOLEAN_TYPE + " " + configField.getName() + " : 1 {};" + EOL;
}

View File

@ -41,7 +41,7 @@ public class CHeaderConsumer extends BaseCHeaderConsumer {
public void endFile() throws IOException {
if (withC_Defines)
cHeader.write(variableRegistry.getDefinesSection());
cHeader.write(getContent());
cHeader.write(getContent().toString());
cHeader.write("// end" + EOL);
cHeader.write("// this section " + state.getHeader() + EOL);
cHeader.close();

View File

@ -404,6 +404,99 @@ public class ConfigFieldParserTest {
"\t/**\n" +
"\toffset 12 bit 0 */\n" +
"\tbool periodMs : 1 {};\n" +
"\t/**\n" +
"\toffset 12 bit 1 */\n" +
"\tbool unusedBit_7_1 : 1 {};\n" +
"\t/**\n" +
"\toffset 12 bit 2 */\n" +
"\tbool unusedBit_7_2 : 1 {};\n" +
"\t/**\n" +
"\toffset 12 bit 3 */\n" +
"\tbool unusedBit_7_3 : 1 {};\n" +
"\t/**\n" +
"\toffset 12 bit 4 */\n" +
"\tbool unusedBit_7_4 : 1 {};\n" +
"\t/**\n" +
"\toffset 12 bit 5 */\n" +
"\tbool unusedBit_7_5 : 1 {};\n" +
"\t/**\n" +
"\toffset 12 bit 6 */\n" +
"\tbool unusedBit_7_6 : 1 {};\n" +
"\t/**\n" +
"\toffset 12 bit 7 */\n" +
"\tbool unusedBit_7_7 : 1 {};\n" +
"\t/**\n" +
"\toffset 12 bit 8 */\n" +
"\tbool unusedBit_7_8 : 1 {};\n" +
"\t/**\n" +
"\toffset 12 bit 9 */\n" +
"\tbool unusedBit_7_9 : 1 {};\n" +
"\t/**\n" +
"\toffset 12 bit 10 */\n" +
"\tbool unusedBit_7_10 : 1 {};\n" +
"\t/**\n" +
"\toffset 12 bit 11 */\n" +
"\tbool unusedBit_7_11 : 1 {};\n" +
"\t/**\n" +
"\toffset 12 bit 12 */\n" +
"\tbool unusedBit_7_12 : 1 {};\n" +
"\t/**\n" +
"\toffset 12 bit 13 */\n" +
"\tbool unusedBit_7_13 : 1 {};\n" +
"\t/**\n" +
"\toffset 12 bit 14 */\n" +
"\tbool unusedBit_7_14 : 1 {};\n" +
"\t/**\n" +
"\toffset 12 bit 15 */\n" +
"\tbool unusedBit_7_15 : 1 {};\n" +
"\t/**\n" +
"\toffset 12 bit 16 */\n" +
"\tbool unusedBit_7_16 : 1 {};\n" +
"\t/**\n" +
"\toffset 12 bit 17 */\n" +
"\tbool unusedBit_7_17 : 1 {};\n" +
"\t/**\n" +
"\toffset 12 bit 18 */\n" +
"\tbool unusedBit_7_18 : 1 {};\n" +
"\t/**\n" +
"\toffset 12 bit 19 */\n" +
"\tbool unusedBit_7_19 : 1 {};\n" +
"\t/**\n" +
"\toffset 12 bit 20 */\n" +
"\tbool unusedBit_7_20 : 1 {};\n" +
"\t/**\n" +
"\toffset 12 bit 21 */\n" +
"\tbool unusedBit_7_21 : 1 {};\n" +
"\t/**\n" +
"\toffset 12 bit 22 */\n" +
"\tbool unusedBit_7_22 : 1 {};\n" +
"\t/**\n" +
"\toffset 12 bit 23 */\n" +
"\tbool unusedBit_7_23 : 1 {};\n" +
"\t/**\n" +
"\toffset 12 bit 24 */\n" +
"\tbool unusedBit_7_24 : 1 {};\n" +
"\t/**\n" +
"\toffset 12 bit 25 */\n" +
"\tbool unusedBit_7_25 : 1 {};\n" +
"\t/**\n" +
"\toffset 12 bit 26 */\n" +
"\tbool unusedBit_7_26 : 1 {};\n" +
"\t/**\n" +
"\toffset 12 bit 27 */\n" +
"\tbool unusedBit_7_27 : 1 {};\n" +
"\t/**\n" +
"\toffset 12 bit 28 */\n" +
"\tbool unusedBit_7_28 : 1 {};\n" +
"\t/**\n" +
"\toffset 12 bit 29 */\n" +
"\tbool unusedBit_7_29 : 1 {};\n" +
"\t/**\n" +
"\toffset 12 bit 30 */\n" +
"\tbool unusedBit_7_30 : 1 {};\n" +
"\t/**\n" +
"\toffset 12 bit 31 */\n" +
"\tbool unusedBit_7_31 : 1 {};\n" +
"};\n" +
"static_assert(sizeof(pid_s) == 16);\n" +
"\n", consumer.getContent());