mirror of https://github.com/FOME-Tech/fome-fw.git
OutputChannelVisitor shares base too
This commit is contained in:
parent
340466333e
commit
f9042f056f
|
@ -4,7 +4,7 @@ import com.rusefi.newparse.layout.*;
|
|||
|
||||
import java.io.PrintStream;
|
||||
|
||||
public class DatalogVisitor extends DatalogVisitorBase {
|
||||
public class DatalogVisitor extends OutputChannelVisitorBase {
|
||||
private static void writeDatalogName(PrintStream ps, String name, String comment) {
|
||||
ps.print(buildDatalogName(name, comment));
|
||||
}
|
||||
|
|
|
@ -5,22 +5,7 @@ import com.rusefi.newparse.parsing.FieldOptions;
|
|||
|
||||
import java.io.PrintStream;
|
||||
|
||||
public class OutputChannelVisitor extends ILayoutVisitor {
|
||||
@Override
|
||||
public void visit(StructLayout struct, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||
if (arrayDims.length == 0) {
|
||||
visit(struct, ps, prefixer, offsetAdd, struct.name);
|
||||
} else if (arrayDims.length == 1) {
|
||||
int elementOffset = offsetAdd + struct.offset;
|
||||
for (int i = 0; i < arrayDims[0]; i++) {
|
||||
visit(struct, ps, prefixer, elementOffset, struct.name + (i + 1));
|
||||
elementOffset += struct.size;
|
||||
}
|
||||
} else {
|
||||
throw new IllegalStateException("Output channels don't support multi dimension arrays");
|
||||
}
|
||||
}
|
||||
|
||||
public class OutputChannelVisitor extends OutputChannelVisitorBase {
|
||||
@Override
|
||||
public void visit(EnumLayout e, PrintStream ps, StructNamePrefixer prefixer, int offsetAdd, int[] arrayDims) {
|
||||
// Output an enum as a scalar, since there's no TS support for enum output channels
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.rusefi.newparse.layout.StructNamePrefixer;
|
|||
|
||||
import java.io.PrintStream;
|
||||
|
||||
public class DatalogVisitorBase extends ILayoutVisitor {
|
||||
public class OutputChannelVisitorBase extends ILayoutVisitor {
|
||||
public static String buildDatalogName(String name, String comment) {
|
||||
String text = (comment == null || comment.isEmpty()) ? name : comment;
|
||||
|
Loading…
Reference in New Issue