Checking in changes that:
[repair.git] / Repair / RepairCompiler / MCC / IR / MetaInclusion.java
index 3d00bbf726fbbcb7c47df1c642c5718720a8760e..e8e4359677f2dd01f1a7deadebacf5fad608138f 100755 (executable)
@@ -3,7 +3,7 @@ package MCC.IR;
 import java.util.*;
 
 public class MetaInclusion extends Inclusion {
-    
+
     Inclusion inclusion;
     Vector rules;
     Vector constraints;
@@ -48,12 +48,12 @@ public class MetaInclusion extends Inclusion {
     }
 
     public void generate(CodeWriter cr) {
-        
+
         this.inclusion.generate(cr);
 
         // for each of the rules, since they are guaranteed to be single quantifiers, and in fact,
-        // even stricter, there only quantifier is the same quantifier just generated by 
-        // the inclusion constraint, we only need to bind each of there vardescriptors in there 
+        // even stricter, there only quantifier is the same quantifier just generated by
+        // the inclusion constraint, we only need to bind each of there vardescriptors in there
         // own blocks (to avoid name space clashes) to the newly quantified variable.
 
         // we know that the inclusion is a  setinlusion
@@ -64,36 +64,36 @@ public class MetaInclusion extends Inclusion {
 
         cr.outputline("if (" + addeditem + ")");
         cr.startblock();
-        
+
         ListIterator allrules = rules.listIterator();
         while (allrules.hasNext()) {
             Rule rule = (Rule) allrules.next();
-            
+
             // we need to grab the vardescriptor of the first quantifeir (which is a setquantifier)
             // and we need to instantiate it inside a new block scope and set it equal to the value
             // in "result" .... we then need to generate the guard and inclusion inside of inner rule
-            
+
             cr.startblock();{
 
-                cr.outputline("// embedding " + rule.getLabel() );
-                
+                cr.outputline("/* embedding " + rule.getLabel() +"*/");
+
                 SetQuantifier sq = (SetQuantifier) rule.quantifiers().next(); // get first qunatifier
                 VarDescriptor vd = sq.getVar();
                 cr.outputline("int " + vd.getSafeSymbol() + " = " + result + ";");
 
                 cr.pushSymbolTable(rule.getSymbolTable());
-                
+
                 VarDescriptor guardval = VarDescriptor.makeNew();
                 rule.getGuardExpr().generate(cr, guardval);
-                
+
                 cr.outputline("if (" + guardval.getSafeSymbol() + ")");
                 cr.startblock(); {
                     rule.getInclusion().generate(cr);
                 } cr.endblock();
 
                 cr.popSymbolTable();
-           
-            } cr.endblock();                
+
+            } cr.endblock();
         }
 
         cr.endblock();
@@ -103,7 +103,7 @@ public class MetaInclusion extends Inclusion {
         ListIterator allconstraints = constraints.listIterator();
         while (allconstraints.hasNext()) {
             Constraint constraint = (Constraint) allconstraints.next();
-            
+
             // ok... um... we need to grab teh vardescripntor of the first quantifier which is guaranteed
             // to be a setquantifier... we then need to bind it to variable, generatedresult.
             // once this is done we can generated the logicstatement and we can then test for pass/fail
@@ -111,32 +111,32 @@ public class MetaInclusion extends Inclusion {
 
             cr.startblock(); {
 
-                cr.outputline("// checking embedded " + constraint.getLabel() );
-                
+                cr.outputline("/* checking embedded " + constraint.getLabel()+"*/" );
+
                 SetQuantifier sq = (SetQuantifier) constraint.quantifiers().next(); // get first qunatifier
                 VarDescriptor vd = sq.getVar();
                 cr.outputline("int " + vd.getSafeSymbol() + " = " + result + ";");
 
                 cr.pushSymbolTable(constraint.getSymbolTable());
-                
+
                 cr.outputline("int maybe = 0;");
-                
+
                 /* now we have to generate the guard test */
-                
+
                 VarDescriptor constraintboolean = VarDescriptor.makeNew("constraintboolean");
                 constraint.getLogicStatement().generate(cr, constraintboolean);
-                
+
                 cr.outputline("if (maybe)");
                 cr.startblock(); {
 
                     cr.outputline("__Success = 0;");
                     cr.outputline("printf(\"maybe fail " + constraint.getNum() + ". \");");
                     cr.outputline("exit(1);");
-           
+
                 } cr.endblock();
-                cr.outputline("else if (!" + constraintboolean.getSafeSymbol() + ")");                
+                cr.outputline("else if (!" + constraintboolean.getSafeSymbol() + ")");
                 cr.startblock(); {
-                
+
                     cr.outputline("__Success = 0;");
                     cr.outputline("printf(\"fail " + constraint.getNum() + ". \");");
                     cr.outputline("exit(1);");
@@ -144,12 +144,11 @@ public class MetaInclusion extends Inclusion {
                 } cr.endblock();
 
                 cr.popSymbolTable();
-           
-            } cr.endblock();                                      
+
+            } cr.endblock();
 
         }
 
     }
 
 }
-