return "/* " + comment + " */";
}
+ private static String SHORT_COMMENT(String comment) {
+ return " // " + comment;
+ }
+
private static String INCLUDE(String header) {
return "#include " + header;
}
newCode.add("inline static void __sequential_init() {");
// Init func_ptr_table
newCode.add("\t" + COMMENT("Init func_ptr_table"));
- newCode.add("\t" + ASSIGN("func_ptr_table", "(void**) malloc(sizeof(void*) * "
- + semantics.interface2Num.size() + " * 2)"));
+ newCode.add("\t"
+ + ASSIGN("func_ptr_table", "(void**) malloc(sizeof(void*) * "
+ + semantics.interface2Num.size() + " * 2)"));
for (String interfaceName : semantics.interfaceName2Construct.keySet()) {
String interfaceNum = Integer.toString(semantics.interface2Num
.get(interfaceName));
- newCode.add("\t" + ASSIGN("func_ptr_table[2 * " + interfaceNum + "]",
- "(void*) &" + interfaceName + "_id"));
- newCode.add("\t" + ASSIGN("func_ptr_table[2 * " + interfaceNum + " + 1]",
- "(void*) &" + interfaceName + "_check_action"));
+ newCode.add("\t"
+ + ASSIGN("func_ptr_table[2 * " + interfaceNum + "]",
+ "(void*) &" + interfaceName + "_id"));
+ newCode.add("\t"
+ + ASSIGN("func_ptr_table[2 * " + interfaceNum + " + 1]",
+ "(void*) &" + interfaceName + "_check_action"));
}
// Init Happens-before rules table
newCode.addAll(generateHBInitAnnotation(semantics));
// Pass init info, including function table info & HB rules
- newCode.add("\t" + COMMENT("Pass init info, including function table info & HB rules"));
+ newCode.add("\t"
+ + COMMENT("Pass init info, including function table info & HB rules"));
String structName = "anno_init", anno = "init";
newCode.add("\t" + STRUCT_NEW_DECLARE_DEFINE(ANNO_INIT, structName));
- newCode.add("\t" + ASSIGN_TO_PTR(structName, "func_table", "func_ptr_table"));
- newCode.add("\t" + ASSIGN_TO_PTR(structName, "func_table_size",
- "INTERFACE_SIZE"));
- newCode.add("\t" + ASSIGN_TO_PTR(structName, "hb_init_table", "hb_init_table"));
- newCode.add("\t" + ASSIGN_TO_PTR(structName, "hb_init_table_size",
- "HB_INIT_TABLE_SIZE"));
+ newCode.add("\t"
+ + ASSIGN_TO_PTR(structName, "func_table", "func_ptr_table"));
+ newCode.add("\t"
+ + ASSIGN_TO_PTR(structName, "func_table_size", "INTERFACE_SIZE"));
+ newCode.add("\t"
+ + ASSIGN_TO_PTR(structName, "hb_init_table", "hb_init_table"));
+ newCode.add("\t"
+ + ASSIGN_TO_PTR(structName, "hb_init_table_size",
+ "HB_INIT_TABLE_SIZE"));
newCode.add("\t" + STRUCT_NEW_DECLARE_DEFINE(SPEC_ANNOTATION, anno));
newCode.add("\t" + ASSIGN_TO_PTR(anno, "type", SPEC_ANNO_TYPE_INIT));
newCode.add("\t" + ASSIGN_TO_PTR(anno, "annotation", structName));
newCode.add("}");
newCode.add(COMMENT("End of Global construct generation in class"));
- //printCode(newCode);
+ // printCode(newCode);
return newCode;
}
.get(right.hbConditionLabel));
newCode.add("\t" + COMMENT(left + " -> " + right));
- newCode.add("\t" + STRUCT_NEW_DECLARE_DEFINE(ANNO_HB_INIT,
- structVarName));
- newCode.add("\t" + ASSIGN_TO_PTR(structVarName,
- "interface_num_before", interfaceNumBefore));
- newCode.add("\t" + ASSIGN_TO_PTR(structVarName,
- "hb_condition_num_before", hbLabelNumBefore));
- newCode.add("\t" + ASSIGN_TO_PTR(structVarName, "interface_num_after",
- interfaceNumAfter));
- newCode.add("\t" + ASSIGN_TO_PTR(structVarName,
- "hb_condition_num_after", hbLabelNumAfter));
-
- // newCode.add(STRUCT_NEW_DECLARE_DEFINE(SPEC_ANNOTATION,
- // annotationVarName));
- // newCode.add(ASSIGN_TO_PTR(annotationVarName,
- // SPEC_ANNOTATION_FIELD_TYPE, SPEC_ANNO_TYPE_HB_INIT));
- // newCode.add(ASSIGN_TO_PTR(annotationVarName,
- // SPEC_ANNOTATION_FIELD_ANNO, structVarName));
- // newCode.add(ANNOTATE(annotationVarName));
+ newCode.add("\t"
+ + STRUCT_NEW_DECLARE_DEFINE(ANNO_HB_INIT, structVarName));
+ newCode.add("\t"
+ + ASSIGN_TO_PTR(structVarName, "interface_num_before",
+ interfaceNumBefore)
+ + SHORT_COMMENT(left.interfaceName));
+ newCode.add("\t"
+ + ASSIGN_TO_PTR(structVarName,
+ "hb_condition_num_before", hbLabelNumBefore)
+ + SHORT_COMMENT(left.hbConditionLabel));
+ newCode.add("\t"
+ + ASSIGN_TO_PTR(structVarName, "interface_num_after",
+ interfaceNumAfter)
+ + SHORT_COMMENT(right.interfaceName));
+ newCode.add("\t"
+ + ASSIGN_TO_PTR(structVarName,
+ "hb_condition_num_after", hbLabelNumAfter)
+ + SHORT_COMMENT(right.hbConditionLabel));
}
}
// Init hb_init_table
newCode.add("\t" + COMMENT("Init hb_init_table"));
- newCode.add("\t" + ASSIGN("hb_init_table", "(" + ANNO_HB_INIT
- + "**) malloc(sizeof(" + ANNO_HB_INIT + "*) * "
- + hbConditionInitIdx + ")"));
+ newCode.add("\t"
+ + ASSIGN("hb_init_table", "(" + ANNO_HB_INIT
+ + "**) malloc(sizeof(" + ANNO_HB_INIT + "*) * "
+ + hbConditionInitIdx + ")"));
// Define HB_INIT_TABLE_SIZE
- newCode.add("\t" + DEFINE("HB_INIT_TABLE_SIZE",
- Integer.toString(hbConditionInitIdx)));
+ newCode.add("\t"
+ + DEFINE("HB_INIT_TABLE_SIZE",
+ Integer.toString(hbConditionInitIdx)));
for (int i = 0; i < hbConditionInitIdx; i++) {
- newCode.add("\t" + ASSIGN("hb_init_table[" + i + "]", "hbConditionInit"
- + i));
+ newCode.add("\t"
+ + ASSIGN("hb_init_table[" + i + "]", "hbConditionInit" + i));
}
return newCode;
}
public static ArrayList<String> generateEntryPointInitCall() {
ArrayList<String> newCode = new ArrayList<String>();
- newCode.add("__sequential_init();");
+ newCode.add("\t" + "__sequential_init();");
return newCode;
}
- // Only generate the declaration of the wrapper, don't do any renaming
- // public static ArrayList<String> generateInterfaceWrapperDeclaration(
- // SemanticsChecker semantics, InterfaceConstruct construct) {
- // ArrayList<String> newCode = new ArrayList<String>();
- // FunctionHeader header = getFunctionHeader(semantics, construct);
- // newCode.add(COMMENT("Declaration of the wrapper"));
- // String templateStr = header.getTemplateFullStr();
- // newCode.add(templateStr);
- // newCode.add(header.getFuncStr() + ";");
- // newCode.add("");
- //
- // return newCode;
- // }
-
public static ArrayList<String> generateInterfaceWrapperDeclaration(
SemanticsChecker semantics, InterfaceConstruct construct) {
FunctionHeader header = getFunctionHeader(semantics, construct);
newCode.add("\t" + COMMENT("Interface begins"));
// Interface begin
String structName = "interface_begin";
- newCode.add("\t" + STRUCT_NEW_DECLARE_DEFINE(ANNO_INTERFACE_BEGIN,
- "interface_begin"));
- newCode.add("\t" + ASSIGN_TO_PTR(structName, "interface_num", interfaceNum));
+ newCode.add("\t"
+ + STRUCT_NEW_DECLARE_DEFINE(ANNO_INTERFACE_BEGIN,
+ "interface_begin"));
+ newCode.add("\t"
+ + ASSIGN_TO_PTR(structName, "interface_num", interfaceNum)
+ + SHORT_COMMENT(construct.name));
String anno = "annotation_interface_begin";
newCode.add("\t" + STRUCT_NEW_DECLARE_DEFINE(SPEC_ANNOTATION, anno));
- newCode.add("\t" + ASSIGN_TO_PTR(anno, "type", SPEC_ANNO_TYPE_INTERFACE_BEGIN));
+ newCode.add("\t"
+ + ASSIGN_TO_PTR(anno, "type", SPEC_ANNO_TYPE_INTERFACE_BEGIN));
newCode.add("\t" + ASSIGN_TO_PTR(anno, "annotation", structName));
newCode.add("\t" + ANNOTATE(semantics, anno));
// Call original renamed function
if (header.returnType.equals("void")) {
- newCode.add("\t" + header.getRenamedCall(SPEC_INTERFACE_WRAPPER) + ";");
+ newCode.add("\t" + header.getRenamedCall(SPEC_INTERFACE_WRAPPER)
+ + ";");
} else {
- newCode.add("\t" + DECLARE_DEFINE(header.returnType, MACRO_RETURN,
- header.getRenamedCall(SPEC_INTERFACE_WRAPPER)));
+ newCode.add("\t"
+ + DECLARE_DEFINE(header.returnType, MACRO_RETURN,
+ header.getRenamedCall(SPEC_INTERFACE_WRAPPER)));
}
// HB conditions
for (String label : construct.hbConditions.keySet()) {
.get(label));
newCode.add("\t" + "if " + BRACE(condition) + " {");
structName = "hb_condition";
- newCode.add("\t\t" + STRUCT_NEW_DECLARE_DEFINE(ANNO_HB_CONDITION, structName));
- newCode.add("\t\t" + ASSIGN_TO_PTR(structName, "interface_num", interfaceNum));
-
- newCode.add("\t\t" + ASSIGN_TO_PTR(structName, "hb_condition_num", hbCondNum));
+ newCode.add("\t\t"
+ + STRUCT_NEW_DECLARE_DEFINE(ANNO_HB_CONDITION, structName));
+ newCode.add("\t\t"
+ + ASSIGN_TO_PTR(structName, "interface_num", interfaceNum)
+ + SHORT_COMMENT(construct.name));
+
+ newCode.add("\t\t"
+ + ASSIGN_TO_PTR(structName, "hb_condition_num", hbCondNum));
anno = "annotation_hb_condition";
- newCode.add("\t\t" + STRUCT_NEW_DECLARE_DEFINE(SPEC_ANNOTATION, anno));
- newCode.add("\t\t" + ASSIGN_TO_PTR(anno, "type", SPEC_ANNO_TYPE_HB_CONDITION));
+ newCode.add("\t\t"
+ + STRUCT_NEW_DECLARE_DEFINE(SPEC_ANNOTATION, anno));
+ newCode.add("\t\t"
+ + ASSIGN_TO_PTR(anno, "type", SPEC_ANNO_TYPE_HB_CONDITION));
newCode.add("\t\t" + ASSIGN_TO_PTR(anno, "annotation", structName));
newCode.add("\t\t" + ANNOTATE(semantics, anno));
newCode.add("\t" + "}");
if (semantics.containsConditionalInterface(new ConditionalInterface(
interfaceName, ""))) {
structName = "hb_condition";
- newCode.add("\t" + STRUCT_NEW_DECLARE_DEFINE(ANNO_HB_CONDITION, structName));
- newCode.add("\t" + ASSIGN_TO_PTR(structName, "interface_num", interfaceNum));
- newCode.add("\t" + ASSIGN_TO_PTR(structName, "hb_condition_num", "0"));
+ newCode.add("\t"
+ + STRUCT_NEW_DECLARE_DEFINE(ANNO_HB_CONDITION, structName));
+ newCode.add("\t"
+ + ASSIGN_TO_PTR(structName, "interface_num", interfaceNum)
+ + SHORT_COMMENT(construct.name));
+ newCode.add("\t"
+ + ASSIGN_TO_PTR(structName, "hb_condition_num", "0"));
anno = "annotation_hb_condition";
newCode.add("\t" + STRUCT_NEW_DECLARE_DEFINE(SPEC_ANNOTATION, anno));
- newCode.add("\t" + ASSIGN_TO_PTR(anno, "type", SPEC_ANNO_TYPE_HB_CONDITION));
+ newCode.add("\t"
+ + ASSIGN_TO_PTR(anno, "type", SPEC_ANNO_TYPE_HB_CONDITION));
newCode.add("\t" + ASSIGN_TO_PTR(anno, "annotation", structName));
newCode.add("\t" + ANNOTATE(semantics, anno));
newCode.add("");
if (!header.returnType.equals("void") || header.args.size() > 0) {
infoStructType = interfaceName + "_info";
infoName = "info";
- newCode.add("\t" + DECLARE_DEFINE(infoStructType + "*", infoName,
- BRACE(infoStructType + "*") + " malloc(sizeof("
- + infoStructType + "))"));
+ newCode.add("\t"
+ + DECLARE_DEFINE(infoStructType + "*", infoName,
+ BRACE(infoStructType + "*") + " malloc(sizeof("
+ + infoStructType + "))"));
if (!header.returnType.equals("void")) {
- newCode.add("\t" + ASSIGN_TO_PTR(infoName, MACRO_RETURN, MACRO_RETURN));
+ newCode.add("\t"
+ + ASSIGN_TO_PTR(infoName, MACRO_RETURN, MACRO_RETURN));
}
for (int i = 0; i < header.args.size(); i++) {
String argName = header.args.get(i).name;
}
structName = "interface_end";
anno = "annoation_interface_end";
- newCode.add("\t" + STRUCT_NEW_DECLARE_DEFINE(ANNO_INTERFACE_END, structName));
- newCode.add("\t" + ASSIGN_TO_PTR(structName, "interface_num", interfaceNum));
+ newCode.add("\t"
+ + STRUCT_NEW_DECLARE_DEFINE(ANNO_INTERFACE_END, structName));
+ newCode.add("\t"
+ + ASSIGN_TO_PTR(structName, "interface_num", interfaceNum)
+ + SHORT_COMMENT(construct.name));
newCode.add("\t" + ASSIGN_TO_PTR(structName, "info", infoName));
newCode.add("\t" + STRUCT_NEW_DECLARE_DEFINE(SPEC_ANNOTATION, anno));
- newCode.add("\t" + ASSIGN_TO_PTR(anno, "type", SPEC_ANNO_TYPE_INTERFACE_END));
+ newCode.add("\t"
+ + ASSIGN_TO_PTR(anno, "type", SPEC_ANNO_TYPE_INTERFACE_END));
newCode.add("\t" + ASSIGN_TO_PTR(anno, "annotation", structName));
newCode.add("\t" + ANNOTATE(semantics, anno));
// Return __RET__ if it's not void
}
String newLine = header.getRenamedHeader(SPEC_INTERFACE_WRAPPER)
.toString();
+ String oldLine = content.get(lineNum + 1);
if (construct instanceof InterfaceConstruct) {
InterfaceConstruct iConstruct = (InterfaceConstruct) construct;
newLine = newLine + " ;";
renameInterface(semantics, defineConstruct);
} else { // This is a declare & define construct
- newLine = newLine + " {";
+ if (oldLine.indexOf('{') != -1)
+ newLine = newLine + " {";
}
} else {
- newLine = newLine + " {";
+ if (oldLine.indexOf('{') != -1)
+ newLine = newLine + " {";
}
- content.set(lineNum, newLine);
+
+ content.set(lineNum + 1, newLine);
}
public static void addAtomicReturn(SemanticsChecker semantics,
addAtomicReturn(semantics, construct);
}
// Generate redundant header files
- newCode.add(COMMENT("Automatically generated code for potential commit point: "
- + construct.label));
+ newCode.add("\t"
+ + COMMENT("Automatically generated code for potential commit point: "
+ + construct.label));
newCode.add("");
// Add annotation
- newCode.add("if (" + construct.condition + ") {");
+ newCode.add("\t" + "if (" + construct.condition + ") {");
String structName = "potential_cp_define", anno = "annotation_potential_cp_define";
- newCode.add(STRUCT_NEW_DECLARE_DEFINE(ANNO_POTENTIAL_CP_DEFINE,
- structName));
+ newCode.add("\t\t"
+ + STRUCT_NEW_DECLARE_DEFINE(ANNO_POTENTIAL_CP_DEFINE,
+ structName));
String labelNum = Integer.toString(semantics.commitPointLabel2Num
.get(construct.label));
- newCode.add(ASSIGN_TO_PTR(structName, "label_num", labelNum));
- newCode.add(STRUCT_NEW_DECLARE_DEFINE(SPEC_ANNOTATION, anno));
- newCode.add(ASSIGN_TO_PTR(anno, "type",
- SPEC_ANNO_TYPE_POTENTIAL_CP_DEFINE));
- newCode.add(ASSIGN_TO_PTR(anno, "annotation", structName));
- newCode.add(ANNOTATE(semantics, anno));
- newCode.add("}");
+ newCode.add("\t\t" + ASSIGN_TO_PTR(structName, "label_num", labelNum));
+ newCode.add("\t\t" + STRUCT_NEW_DECLARE_DEFINE(SPEC_ANNOTATION, anno));
+ newCode.add("\t\t"
+ + ASSIGN_TO_PTR(anno, "type",
+ SPEC_ANNO_TYPE_POTENTIAL_CP_DEFINE));
+ newCode.add("\t\t" + ASSIGN_TO_PTR(anno, "annotation", structName));
+ newCode.add("\t\t" + ANNOTATE(semantics, anno));
+ newCode.add("\t" + "}");
return newCode;
}
addAtomicReturn(semantics, construct);
}
// Generate redundant header files
- newCode.add("\t" + COMMENT("Automatically generated code for commit point define check: "
- + construct.label));
+ newCode.add("\t"
+ + COMMENT("Automatically generated code for commit point define check: "
+ + construct.label));
newCode.add("");
// Add annotation
newCode.add("\t" + "if (" + construct.condition + ") {");
String structName = "cp_define_check", anno = "annotation_cp_define_check";
- newCode.add("\t\t" + STRUCT_NEW_DECLARE_DEFINE(ANNO_CP_DEFINE_CHECK, structName));
+ newCode.add("\t\t"
+ + STRUCT_NEW_DECLARE_DEFINE(ANNO_CP_DEFINE_CHECK, structName));
String labelNum = Integer.toString(semantics.commitPointLabel2Num
.get(construct.label));
newCode.add("\t\t" + ASSIGN_TO_PTR(structName, "label_num", labelNum));
newCode.add("\t\t" + STRUCT_NEW_DECLARE_DEFINE(SPEC_ANNOTATION, anno));
- newCode.add("\t\t" + ASSIGN_TO_PTR(anno, "type", SPEC_ANNO_TYPE_CP_DEFINE_CHECK));
+ newCode.add("\t\t"
+ + ASSIGN_TO_PTR(anno, "type", SPEC_ANNO_TYPE_CP_DEFINE_CHECK));
newCode.add("\t\t" + ASSIGN_TO_PTR(anno, "annotation", structName));
newCode.add("\t\t" + ANNOTATE(semantics, anno));
newCode.add("\t" + "}");
SemanticsChecker semantics, CPDefineConstruct construct) {
ArrayList<String> newCode = new ArrayList<String>();
// Generate redundant header files
- newCode.add("\t" + COMMENT("Automatically generated code for commit point define: "
- + construct.label));
+ newCode.add("\t"
+ + COMMENT("Automatically generated code for commit point define: "
+ + construct.label));
newCode.add("");
// Add annotation
newCode.add("\t" + "if (" + construct.condition + ") {");
String structName = "cp_define", anno = "annotation_cp_define";
- newCode.add("\t\t" + STRUCT_NEW_DECLARE_DEFINE(ANNO_CP_DEFINE, structName));
+ newCode.add("\t\t"
+ + STRUCT_NEW_DECLARE_DEFINE(ANNO_CP_DEFINE, structName));
String labelNum = Integer.toString(semantics.commitPointLabel2Num
.get(construct.label));
String potentialLabelNum = Integer
.toString(semantics.commitPointLabel2Num
.get(construct.potentialCPLabel));
newCode.add("\t\t" + ASSIGN_TO_PTR(structName, "label_num", labelNum));
- newCode.add("\t\t" + ASSIGN_TO_PTR(structName, "potential_cp_label_num",
- potentialLabelNum));
+ newCode.add("\t\t"
+ + ASSIGN_TO_PTR(structName, "potential_cp_label_num",
+ potentialLabelNum));
newCode.add("\t\t" + STRUCT_NEW_DECLARE_DEFINE(SPEC_ANNOTATION, anno));
- newCode.add("\t\t" + ASSIGN_TO_PTR(anno, "type", SPEC_ANNO_TYPE_CP_DEFINE));
+ newCode.add("\t\t"
+ + ASSIGN_TO_PTR(anno, "type", SPEC_ANNO_TYPE_CP_DEFINE));
newCode.add("\t\t" + ASSIGN_TO_PTR(anno, "annotation", structName));
newCode.add("\t\t" + ANNOTATE(semantics, anno));
newCode.add("\t" + "}");
public final HashMap<String, ArrayList<InterfaceConstruct>> CPLabel2InterfaceConstruct;
public final HashMap<String, Integer> interface2Num;
+ public final HashMap<Integer, String> num2Interface;
public final HashMap<String, Integer> hbLabel2Num;
+ public final HashMap<Integer, String> num2HBLabel;
public final HashMap<String, Integer> commitPointLabel2Num;
+ public final HashMap<Integer, String> num2CommitPointLabel;
private HashMap<String, String> options;
private HashMap<ConditionalInterface, HashSet<ConditionalInterface>> hbConditions;
private ClassBeginConstruct classBeginConstruct;
private ClassEndConstruct classEndConstruct;
private GlobalConstruct globalConstruct;
-
+
private String templateStr;
private String templateFullStr;
private String className;
this.classEndConstruct = null;
this.interface2Num = new HashMap<String, Integer>();
+ this.num2Interface = new HashMap<Integer, String>();
this.hbLabel2Num = new HashMap<String, Integer>();
+ this.num2HBLabel = new HashMap<Integer, String>();
// Immediately init the true HB-condition to be 0
hbLabel2Num.put("", 0);
+ num2HBLabel.put(0, "");
this.commitPointLabel2Num = new HashMap<String, Integer>();
+ this.num2CommitPointLabel = new HashMap<Integer, String>();
_interfaceNum = 0;
_hbLabelNum = 0;
_commitPointNum = 0;
-
+
templateStr = null;
templateFullStr = null;
className = null;
}
-
+
public ClassBeginConstruct getClassBeginConstruct() {
return this.classBeginConstruct;
}
-
+
public ClassEndConstruct getClassEndConstruct() {
return this.classEndConstruct;
}
-
+
public String getTemplateFullStr() {
return this.templateFullStr;
}
-
+
public String getTemplateStr() {
return this.templateStr;
}
-
+
public String getClassName() {
return this.className;
}
-
+
public GlobalConstruct getGlobalConstruct() {
return this.globalConstruct;
}
public HashMap<ConditionalInterface, HashSet<ConditionalInterface>> getHBConditions() {
return this.hbConditions;
}
-
+
/**
* Check if the conditional interface is in the HB checking list
+ *
* @param condInterface
* @return
*/
- public boolean containsConditionalInterface(ConditionalInterface condInterface) {
+ public boolean containsConditionalInterface(
+ ConditionalInterface condInterface) {
if (hbConditions.containsKey(condInterface))
return true;
for (ConditionalInterface key : hbConditions.keySet()) {
// Number the HB-condition label
hbLabel2Num.put(label, _hbLabelNum++);
+ num2HBLabel.put(_hbLabelNum, label);
}
}
}
// Number the interface label
interface2Num.put(iConstruct.name, _interfaceNum++);
+ num2Interface.put(_interfaceNum, iConstruct.name);
interfaceName2Construct.put(iConstruct.name,
(InterfaceConstruct) constructs.get(i));
PotentialCPDefineConstruct theConstruct = (PotentialCPDefineConstruct) construct;
label = theConstruct.label;
checkLabelDuplication(construct, label);
- // Number the commit_point label
+ // Number the commit point potential commit point label
commitPointLabel2Num.put(label, _commitPointNum++);
+ num2CommitPointLabel.put(_commitPointNum, label);
potentialCPLabel2Construct.put(label,
(PotentialCPDefineConstruct) construct);
CPDefineCheckConstruct theConstruct = (CPDefineCheckConstruct) construct;
label = theConstruct.label;
checkLabelDuplication(construct, label);
- // Number the commit_point label
+ // Number the commit point define check label
commitPointLabel2Num.put(label, _commitPointNum++);
+ num2CommitPointLabel.put(_commitPointNum, label);
CPLabel2Construct.put(label, construct);
} else if (construct instanceof CPDefineConstruct) {
CPDefineConstruct theConstruct = (CPDefineConstruct) construct;
label = theConstruct.label;
checkLabelDuplication(construct, label);
- // Number the commit_point label
+ // Number the commit point define label
commitPointLabel2Num.put(label, _commitPointNum++);
+ num2CommitPointLabel.put(_commitPointNum, label);
CPLabel2Construct.put(label, construct);
} else if (construct instanceof EntryPointConstruct) {
interfaceName2DefineConstruct.put(name, theConstruct);
} else if (construct instanceof ClassBeginConstruct) {
classBeginConstruct = (ClassBeginConstruct) construct;
- ArrayList<String> content = srcFilesInfo.get(classBeginConstruct.file).content;
- String firstLine = content.get(classBeginConstruct.beginLineNum), secondLine;
+ ArrayList<String> content = srcFilesInfo
+ .get(classBeginConstruct.file).content;
+ String firstLine = content
+ .get(classBeginConstruct.beginLineNum + 1), secondLine;
if (firstLine.startsWith("template")) {
- secondLine = content.get(classBeginConstruct.beginLineNum + 1);
+ secondLine = content
+ .get(classBeginConstruct.beginLineNum + 1);
templateFullStr = firstLine;
templateStr = ParserUtils.getTemplateStr(firstLine);
className = ParserUtils.getClassName(secondLine);
} else {
className = ParserUtils.getClassName(firstLine);
}
-
+
} else if (construct instanceof ClassEndConstruct) {
classEndConstruct = (ClassEndConstruct) construct;
className = getOption("CLASS");