This commit is contained in:
rusefillc 2023-11-27 14:45:48 -05:00
parent 3bb5de070e
commit 3aab9906ef
1 changed files with 19 additions and 4 deletions

View File

@ -173,7 +173,19 @@ public class TuneCanTool {
if (data == null) if (data == null)
continue; continue;
methods.append(data.getCsourceMethod("engineConfiguration")); String parentReference;
if (cf.getParent().getName().equals("engine_configuration_s")) {
parentReference = "engineConfiguration->";
} else if (cf.getParent().getName().equals("persistent_config_s")) {
parentReference = "config->";
} else {
// todo: for instance map.samplingAngle
//throw new IllegalStateException("Unexpected " + cf.getParent());
System.out.println(" " + cf);
continue;
}
methods.append(data.getCsourceMethod(parentReference));
invokeMethods.append(data.getCinvokeMethod()); invokeMethods.append(data.getCinvokeMethod());
continue; continue;
@ -225,12 +237,15 @@ public class TuneCanTool {
} }
private static ConfigField findField(ReaderStateImpl state, String name, StringBuffer context) { private static ConfigField findField(ReaderStateImpl state, String name, StringBuffer context) {
return doLook(state, name, context); ConfigField field = doLook(state, name, context, "engine_configuration_s");
if (field != null)
return field;
return doLook(state, name, context, "persistent_config_s");
} }
@Nullable @Nullable
private static ConfigField doLook(ReaderStateImpl state, String name, StringBuffer context) { private static ConfigField doLook(ReaderStateImpl state, String name, StringBuffer context, String parentStructName) {
ConfigStructure s = state.getStructures().get("engine_configuration_s"); ConfigStructure s = state.getStructures().get(parentStructName);
// log.info("We have a custom value " + name); // log.info("We have a custom value " + name);
ConfigField cf = s.getTsFieldByName(name); ConfigField cf = s.getTsFieldByName(name);
if (cf != null) { if (cf != null) {