Added:
[repair.git] / Repair / RepairCompiler / MCC / IR / LogicStatement.java
index aa093b4da76f4c2841488acf2abf9f753e05ad17..ab23ec37006a7bfe5219f0e6be00fba8d5bb0774 100755 (executable)
@@ -9,8 +9,10 @@ public class LogicStatement {
     public static final Operation NOT = new Operation("NOT");
 
     public String name() {
+       if (op==NOT)
+           return "!"+left.name();
        String name=left.name();
-       name+=op.toString();
+       name+=" "+op.toString()+" ";
        if (right!=null)
            name+=right.name();
        return name;
@@ -96,7 +98,7 @@ public class LogicStatement {
             left.generate(writer, leftd);
 
             writer.outputline("// 3-valued NOT");
-            writer.outputline("if (!maybe)");
+           //            writer.outputline("if (!maybe)"); //this isn't really necessary
             writer.startblock();
             writer.outputline(dest.getSafeSymbol() + " =  !" + leftd.getSafeSymbol() + ";");
             writer.endblock();
@@ -107,7 +109,7 @@ public class LogicStatement {
             String lm = (VarDescriptor.makeNew("leftmaybe")).getSafeSymbol();
             left.generate(writer, leftd);
             writer.outputline("int " + lm + " = maybe;");
-            
+            writer.outputline("maybe=0;");
             VarDescriptor rightd = VarDescriptor.makeNew("rightboolean");
             String rm = (VarDescriptor.makeNew("rightmaybe")).getSafeSymbol();
             assert right != null;
@@ -142,7 +144,7 @@ public class LogicStatement {
                  * 1110  1 X
                  * 1111  1 X
                  *
-                 * M = (L*RM) + (R*LM) + (LM*RM)                 
+                 * M = (L*RM) + (R*LM) + (LM*RM)
                  * O = (L*R)
                  */