+
+ Constraint constraint = (Constraint) constraints.elementAt(i);
+
+ {
+
+ CodeWriter cr = new StandardCodeWriter(output);
+ cr.pushSymbolTable(constraint.getSymbolTable());
+
+ cr.outputline("// checking " + constraint.getLabel());
+ cr.startblock();
+
+ ListIterator quantifiers = constraint.quantifiers();
+
+ while (quantifiers.hasNext()) {
+ Quantifier quantifier = (Quantifier) quantifiers.next();
+ quantifier.generate_open(cr);
+ }
+
+ 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.startblock();
+
+ cr.outputline("__Success = 0;");
+ cr.outputline("printf(\"fail " + constraint.getNum() + ". \");");
+ cr.outputline("exit(1);");
+ cr.endblock();
+
+ while (quantifiers.hasPrevious()) {
+ Quantifier quantifier = (Quantifier) quantifiers.previous();
+ cr.endblock();
+ }
+
+ cr.endblock();
+ cr.outputline("");
+ cr.outputline("");
+ }
+