parent
f936204798
commit
484103deb9
|
@ -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.
|
@ -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++;
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue