Skip to content
Snippets Groups Projects
Commit 3f21e26b authored by hansen's avatar hansen
Browse files

fixed bug in trace printer

parent c17aaecb
No related branches found
No related tags found
No related merge requests found
...@@ -72,11 +72,6 @@ public class TLC4B { ...@@ -72,11 +72,6 @@ public class TLC4B {
private void printResults(TLCResults results, boolean createTraceFile) { private void printResults(TLCResults results, boolean createTraceFile) {
String s = "";
for (int i = 0; i < 10; i++) {
s += i;
}
System.out.println("Parsing time: " + StopWatch.getRunTime("Parsing") System.out.println("Parsing time: " + StopWatch.getRunTime("Parsing")
+ " ms"); + " ms");
System.out.println("Translation time: " + StopWatch.getRunTime("Pure") System.out.println("Translation time: " + StopWatch.getRunTime("Pure")
...@@ -89,6 +84,7 @@ public class TLC4B { ...@@ -89,6 +84,7 @@ public class TLC4B {
+ results.getNumberOfTransitions()); + results.getNumberOfTransitions());
System.out.println("Result: " + results.getResultString()); System.out.println("Result: " + results.getResultString());
if (results.hasTrace() && createTraceFile) { if (results.hasTrace() && createTraceFile) {
String trace = results.getTrace(); String trace = results.getTrace();
String tracefileName = machineFileNameWithoutFileExtension String tracefileName = machineFileNameWithoutFileExtension
......
...@@ -99,11 +99,9 @@ public class TLCRunner { ...@@ -99,11 +99,9 @@ public class TLCRunner {
//list.add("-config"); //list.add("-config");
//list.add(machineName + ".cfg"); //list.add(machineName + ".cfg");
list.add(machineName); list.add(machineName);
System.out.println(path.getPath());
ToolIO.setUserDir(path.getPath()); ToolIO.setUserDir(path.getPath());
String[] args = list.toArray(new String[list.size()]); String[] args = list.toArray(new String[list.size()]);
TLC tlc = new TLC(); TLC tlc = new TLC();
// handle parameters // handle parameters
if (tlc.handleParameters(args)) { if (tlc.handleParameters(args)) {
tlc.setResolver(new SimpleFilenameToStream()); tlc.setResolver(new SimpleFilenameToStream());
...@@ -112,7 +110,6 @@ public class TLCRunner { ...@@ -112,7 +110,6 @@ public class TLCRunner {
tlc.process(); tlc.process();
} catch (Exception e) { } catch (Exception e) {
} }
} }
// System.setOut(systemOut); // System.setOut(systemOut);
// ArrayList<String> messages = btlcStream.getArrayList(); // ArrayList<String> messages = btlcStream.getArrayList();
......
...@@ -30,6 +30,7 @@ import tlc2.value.SubsetValue; ...@@ -30,6 +30,7 @@ import tlc2.value.SubsetValue;
import tlc2.value.TupleValue; import tlc2.value.TupleValue;
import tlc2.value.UnionValue; import tlc2.value.UnionValue;
import tlc2.value.Value; import tlc2.value.Value;
import tlc2.value.ValueEnumeration;
import tlc2.value.ValueVec; import tlc2.value.ValueVec;
import util.UniqueString; import util.UniqueString;
import static tlc2.value.ValueConstants.*; import static tlc2.value.ValueConstants.*;
...@@ -178,7 +179,6 @@ public class TracePrinter { ...@@ -178,7 +179,6 @@ public class TracePrinter {
} else { } else {
BType subtype = ((FunctionType) type).getRange(); BType subtype = ((FunctionType) type).getRange();
res.append("["); res.append("[");
System.out.println();
res.append(parseEnumerationValue(((TupleValue) val).elems, res.append(parseEnumerationValue(((TupleValue) val).elems,
subtype)); subtype));
res.append("]"); res.append("]");
...@@ -233,35 +233,25 @@ public class TracePrinter { ...@@ -233,35 +233,25 @@ public class TracePrinter {
case SETOFTUPLESVALUE: { case SETOFTUPLESVALUE: {
SetOfTuplesValue s = (SetOfTuplesValue) val; SetOfTuplesValue s = (SetOfTuplesValue) val;
SetType t = (SetType) type; ValueEnumeration e = s.elements();
PairType pair = (PairType) t.getSubtype(); return parseSetValue(res, s.size(), type, e);
res.append(parseValue(s.sets[0], new SetType(pair.getFirst())));
res.append("*");
res.append(parseValue(s.sets[1], new SetType(pair.getSecond())));
return res;
} }
case SETCUPVALUE: { case SETCUPVALUE: {
SetCupValue s = (SetCupValue) val; SetCupValue s = (SetCupValue) val;
res.append(parseValue(s.set1, type)); ValueEnumeration e = s.elements();
res.append("\\/"); return parseSetValue(res, s.size(), type, e);
res.append(parseValue(s.set2, type));
return res;
} }
case SETCAPVALUE: { case SETCAPVALUE: {
SetCapValue s = (SetCapValue) val; SetCapValue s = (SetCapValue) val;
res.append(parseValue(s.set1, type)); ValueEnumeration e = s.elements();
res.append("/\\"); return parseSetValue(res, s.size(), type, e);
res.append(parseValue(s.set2, type));
return res;
} }
case SETDIFFVALUE: { case SETDIFFVALUE: {
SetDiffValue s = (SetDiffValue) val; SetDiffValue s = (SetDiffValue) val;
res.append(parseValue(s.set1, type)); ValueEnumeration e = s.elements();
res.append("-"); return parseSetValue(res, s.size(), type, e);
res.append(parseValue(s.set2, type));
return res;
} }
case SUBSETVALUE: { case SUBSETVALUE: {
...@@ -338,6 +328,23 @@ public class TracePrinter { ...@@ -338,6 +328,23 @@ public class TracePrinter {
throw new RuntimeException("not supported construct: " + val); throw new RuntimeException("not supported construct: " + val);
} }
private StringBuilder parseSetValue(StringBuilder res, int size,
BType type, ValueEnumeration e) {
SetType t = (SetType) type;
res.append("{");
for (int i = 0; i < size; i++) {
Value v = e.nextElement();
if (i != 0) {
res.append(", ");
}
if (v != null) {
res.append(parseValue(v, t.getSubtype()));
}
}
res.append("}");
return res;
}
private StringBuilder parseValueVec(ValueVec elems, BType bType) { private StringBuilder parseValueVec(ValueVec elems, BType bType) {
StringBuilder res = new StringBuilder(); StringBuilder res = new StringBuilder();
for (int i = 0; i < elems.size(); i++) { for (int i = 0; i < elems.size(); i++) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment