lua getOutput documentation generator #4867

cheap progress
This commit is contained in:
rusefillc 2023-03-17 21:19:33 -04:00
parent f584c6dc84
commit d79743de90
5 changed files with 31 additions and 4 deletions

Binary file not shown.

View File

@ -29,7 +29,9 @@ import static com.rusefi.output.GetOutputValueConsumer.wrapSwitchStatement;
public class GetConfigValueConsumer implements ConfigurationConsumer {
private static final String CONFIG_ENGINE_CONFIGURATION = "config->engineConfiguration.";
private static final String ENGINE_CONFIGURATION = "engineConfiguration.";
static final String FILE_HEADER = "#include \"pch.h\"\n" +
static final String FILE_HEADER =
"// generated by " + GetConfigValueConsumer.class.getSimpleName() + ".java\n" +
"#include \"pch.h\"\n" +
"#include \"value_lookup.h\"\n";
private static final String GET_METHOD_HEADER =

View File

@ -104,6 +104,7 @@ public class GetOutputValueConsumer implements ConfigurationConsumer {
int hash = HashUtil.hash(pair.getUserName());
if (hashConflicts.get(hash).get() == 1) {
switchBody.append("// " + pair.getUserName() + "\n");
switchBody.append(before);
switchBody.append("\t\tcase " + hash + ":\n");
switchBody.append("\t" + returnLine);

View File

@ -59,13 +59,16 @@ public class GetConfigValueConsumerTest {
"\t}\n" +
"\t}\n", getConfigValueConsumer.getSetterBody());
assertEquals("#include \"pch.h\"\n" +
assertEquals("// generated by GetConfigValueConsumer.java\n" +
"#include \"pch.h\"\n" +
"#include \"value_lookup.h\"\n" +
"float getConfigValueByName(const char *name) {\n" +
"\tint hash = djb2lowerCase(name);\n" +
"\tswitch(hash) {\n" +
"// iat.config.tempC_1\n" +
"\t\tcase -672272162:\n" +
"\t\t\treturn config->iat.config.tempC_1;\n" +
"// iat.adcChannel\n" +
"\t\tcase -1237776078:\n" +
"\t\t\treturn config->iat.adcChannel;\n" +
"\t}\n" +
@ -91,8 +94,10 @@ public class GetConfigValueConsumerTest {
assertEquals("float getConfigValueByName(const char *name) {\n" +
"\tint hash = djb2lowerCase(name);\n" +
"\tswitch(hash) {\n" +
"// iat.config.tempC_1\n" +
"\t\tcase -672272162:\n" +
"\t\t\treturn config->iat.config.tempC_1;\n" +
"// iat.adcChannel\n" +
"\t\tcase -1237776078:\n" +
"\t\t\treturn config->iat.adcChannel;\n" +
"\t}\n" +
@ -155,37 +160,52 @@ public class GetConfigValueConsumerTest {
GetConfigValueConsumer getConfigValueConsumer = new GetConfigValueConsumer();
state.readBufferedReader(test, getConfigValueConsumer);
assertEquals("#include \"pch.h\"\n" +
assertEquals("// generated by GetConfigValueConsumer.java\n" +
"#include \"pch.h\"\n" +
"#include \"value_lookup.h\"\n" +
"float getConfigValueByName(const char *name) {\n" +
"\tint hash = djb2lowerCase(name);\n" +
"\tswitch(hash) {\n" +
"// clt.config.tempC_1\n" +
"\t\tcase -1832527325:\n" +
"\t\t\treturn config->clt.config.tempC_1;\n" +
"// clt.config.map.sensor.highValue\n" +
"\t\tcase 1819278123:\n" +
"\t\t\treturn config->clt.config.map.sensor.highValue;\n" +
"// clt.config.map.sensor.hwChannel\n" +
"\t\tcase 581685574:\n" +
"\t\t\treturn config->clt.config.map.sensor.hwChannel;\n" +
"// clt.config.injector.flow\n" +
"\t\tcase 382574846:\n" +
"\t\t\treturn config->clt.config.injector.flow;\n" +
"// clt.config.bias_resistor\n" +
"\t\tcase -653172717:\n" +
"\t\t\treturn config->clt.config.bias_resistor;\n" +
"// clt.adcChannel\n" +
"\t\tcase -1144186889:\n" +
"\t\t\treturn config->clt.adcChannel;\n" +
"// issue_294_31\n" +
"\t\tcase -1571463185:\n" +
"\t\t\treturn config->issue_294_31;\n" +
"// baseFuel\n" +
"\t\tcase 727098956:\n" +
"\t\t\treturn config->baseFuel;\n" +
"// afr_type\n" +
"\t\tcase -1120008897:\n" +
"\t\t\treturn config->afr_type;\n" +
"// speedToRpmRatio\n" +
"\t\tcase -685727673:\n" +
"\t\t\treturn config->speedToRpmRatio;\n" +
"// afr_typet\n" +
"\t\tcase 1694412179:\n" +
"\t\t\treturn config->afr_typet;\n" +
"// vehicleSpeedKph\n" +
"\t\tcase -1925174695:\n" +
"\t\t\treturn config->vehicleSpeedKph;\n" +
"// isForcedInduction\n" +
"\t\tcase -617915487:\n" +
"\t\t\treturn config->isForcedInduction;\n" +
"// enableFan1WithAc\n" +
"\t\tcase -298185774:\n" +
"\t\t\treturn config->enableFan1WithAc;\n" +
"\t}\n" +

View File

@ -150,19 +150,23 @@ public class OutputsTest {
outputValueConsumer.conditional = "EFI_BOOST_CONTROL";
state.readBufferedReader(test, (outputValueConsumer));
assertEquals(
"#include \"pch.h\"\n" +
"// generated by GetConfigValueConsumer.java\n" +
"#include \"pch.h\"\n" +
"#include \"value_lookup.h\"\n" +
"float getOutputValueByName(const char *name) {\n" +
"\tint hash = djb2lowerCase(name);\n" +
"\tswitch(hash) {\n" +
"// issue_294_31\n" +
"#if EFI_BOOST_CONTROL\n" +
"\t\tcase -1571463185:\n" +
"\t\t\treturn engine->outputChannels.issue_294_31;\n" +
"#endif\n" +
"// enableFan1WithAc\n" +
"#if EFI_BOOST_CONTROL\n" +
"\t\tcase -298185774:\n" +
"\t\t\treturn engine->outputChannels.enableFan1WithAc;\n" +
"#endif\n" +
"// hwChannel\n" +
"#if EFI_BOOST_CONTROL\n" +
"\t\tcase -709106787:\n" +
"\t\t\treturn engine->outputChannels.hwChannel;\n" +