+
+ public static ArrayList<String> generateHBInitAnnotation(
+ SemanticsChecker semantics) {
+ ArrayList<String> newCode = new ArrayList<String>();
+ int hbConditionInitIdx = 0;
+ for (ConditionalInterface left : semantics.getHBConditions().keySet()) {
+ for (ConditionalInterface right : semantics.getHBConditions().get(
+ left)) {
+ String structVarName = "hbConditionInit" + hbConditionInitIdx;
+ hbConditionInitIdx++;
+ int interfaceNumBefore = semantics.interface2Num
+ .get(left.interfaceName), hbLabelNumBefore = semantics.hbLabel2Num
+ .get(left.hbConditionLabel), interfaceNumAfter = semantics.interface2Num
+ .get(right.interfaceName), hbLabelNumAfter = semantics.hbLabel2Num
+ .get(right.hbConditionLabel);
+ newCode.add(ANNO_HB_INIT + " " + structVarName + ";");
+
+ newCode.add(structVarName + "." + "interface_num_before"
+ + " = " + interfaceNumBefore + ";");
+ newCode.add(structVarName + "." + "hb_condition_num_before"
+ + " = " + hbLabelNumBefore + ";");
+ newCode.add(structVarName + "." + "interface_num_after" + " = "
+ + interfaceNumAfter + ";");
+ newCode.add(structVarName + "." + "hb_condition_num_after"
+ + " = " + hbLabelNumAfter + ";");
+
+ newCode.add(CDSAnnotate + "(" + CDSAnnotateType + ", &" + structVarName + ");");
+ }
+ }
+ return newCode;
+ }