Revert "looks like dead logic"

This reverts commit 607cdbb132.
This commit is contained in:
Andrey 2022-09-02 23:07:09 -04:00
parent 607cdbb132
commit 4e27fc85ab
5 changed files with 18 additions and 1 deletions

View File

@ -82,6 +82,8 @@ public class ParseState {
if (stringValueMap == null)
return null;
for (Value value : stringValueMap.values()) {
if (value.isForceSize())
continue;
if (isNumeric(value.getValue())) {
valueNameById.put(value.getIntValue(), value.getName());

Binary file not shown.

View File

@ -12,6 +12,10 @@ import java.util.List;
import java.util.Map;
public class ToJavaEnum {
public static final String FORCE_2_BYTES_SIZE = "Force_2_bytes_size";
public static final String FORCE_4_BYTES_SIZE = "Force_4_bytes_size";
public static void main(String[] args) throws IOException {
InvokeReader invokeReader = new InvokeReader(args).invoke();
String outputPath = invokeReader.getOutputPath();
@ -49,7 +53,9 @@ public class ToJavaEnum {
int index = 0;
for (Value value : sorted) {
int numericValue = value.getIntValueMaybeResolve(registry);
if (index != numericValue)
if (index != numericValue
&& !value.getName().startsWith(FORCE_2_BYTES_SIZE)
&& !value.getName().startsWith(FORCE_4_BYTES_SIZE))
throw new IllegalStateException("Got explicit ordinal " + numericValue + " instead of ordinal " + index + " in " + value);
sb.append("\t" + value.getName() + ",\n");
index++;

View File

@ -95,6 +95,8 @@ public class VariableRegistry {
TreeMap<Integer, String> valueNameById = new TreeMap<>();
for (Value value : stringValueMap.values()) {
if (value.isForceSize())
continue;
if (isNumeric(value.getValue())) {
valueNameById.put(value.getIntValue(), value.getName());

View File

@ -4,6 +4,9 @@ import com.rusefi.VariableRegistry;
import java.util.Objects;
import static com.rusefi.ToJavaEnum.FORCE_2_BYTES_SIZE;
import static com.rusefi.ToJavaEnum.FORCE_4_BYTES_SIZE;
public class Value implements Comparable<Value> {
private final String name;
private final String value;
@ -13,6 +16,10 @@ public class Value implements Comparable<Value> {
this.value = value;
}
public boolean isForceSize() {
return getName().startsWith(FORCE_2_BYTES_SIZE) || getName().startsWith(FORCE_4_BYTES_SIZE);
}
public String getName() {
return name;
}