gen_config: add rusefi_config_custom.txt to override #defines #727
This commit is contained in:
parent
b863a673ef
commit
a48dd78966
Binary file not shown.
|
@ -279,7 +279,6 @@ public class ConfigDefinition {
|
||||||
|
|
||||||
public static int getSize(String s) {
|
public static int getSize(String s) {
|
||||||
if (VariableRegistry.INSTANCE.intValues.containsKey(s)) {
|
if (VariableRegistry.INSTANCE.intValues.containsKey(s)) {
|
||||||
VariableRegistry.INSTANCE.usedValues.add(s);
|
|
||||||
return VariableRegistry.INSTANCE.intValues.get(s);
|
return VariableRegistry.INSTANCE.intValues.get(s);
|
||||||
}
|
}
|
||||||
return Integer.parseInt(s);
|
return Integer.parseInt(s);
|
||||||
|
|
|
@ -19,7 +19,6 @@ public class VariableRegistry extends TreeMap<String, String> {
|
||||||
private final Pattern VAR = Pattern.compile("(@@(.*?)@@)");
|
private final Pattern VAR = Pattern.compile("(@@(.*?)@@)");
|
||||||
|
|
||||||
public Map<String, Integer> intValues = new HashMap<>();
|
public Map<String, Integer> intValues = new HashMap<>();
|
||||||
public Set<String> usedValues = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
|
|
||||||
|
|
||||||
private final Map<String, String> cAllDefinitions = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
private final Map<String, String> cAllDefinitions = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||||
private final Map<String, String> javaDefinitions = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
private final Map<String, String> javaDefinitions = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||||
|
@ -49,6 +48,10 @@ public class VariableRegistry extends TreeMap<String, String> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void register(String var, String value) {
|
public void register(String var, String value) {
|
||||||
|
if (containsKey(var)) {
|
||||||
|
System.out.println("Not redefining " + var);
|
||||||
|
return;
|
||||||
|
}
|
||||||
System.out.println("Registering " + var + " as " + value);
|
System.out.println("Registering " + var + " as " + value);
|
||||||
put(var, value);
|
put(var, value);
|
||||||
|
|
||||||
|
@ -61,8 +64,6 @@ public class VariableRegistry extends TreeMap<String, String> {
|
||||||
try {
|
try {
|
||||||
int intValue = Integer.parseInt(value);
|
int intValue = Integer.parseInt(value);
|
||||||
System.out.println("key [" + var + "] value: " + intValue);
|
System.out.println("key [" + var + "] value: " + intValue);
|
||||||
if (usedValues.contains(var))
|
|
||||||
throw new IllegalStateException("Not allowed to redefine after value was used: " + var);
|
|
||||||
intValues.put(var, intValue);
|
intValues.put(var, intValue);
|
||||||
javaDefinitions.put(var, "\tpublic static final int " + var + " = " + intValue + ";" + EOL);
|
javaDefinitions.put(var, "\tpublic static final int " + var + " = " + intValue + ";" + EOL);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
|
|
Loading…
Reference in New Issue