From: Peizhao Ou <peizhaoo@uci.edu>
Date: Thu, 14 Nov 2013 02:34:38 +0000 (-0800)
Subject: fix bugs
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b8cf41d373298fb6f7f3c1c38158e6c98684a2fa;p=cdsspec-compiler.git

fix bugs
---

diff --git a/notes/sequential_spec.txt b/notes/sequential_spec.txt
index 73e85cc..ef3baff 100644
--- a/notes/sequential_spec.txt
+++ b/notes/sequential_spec.txt
@@ -75,7 +75,7 @@
    index = list.indexOf(elem);
    index = list.indexOf(elem, 1);
    7) PushAtIndex
-   list.pushAtIdex(1);
+   list.pushAtIndex(1);
    8) PushAfterElem
    list.pushAfterElem(target, elem, 10); // find the first matched target from index 10,
                                          // insert elem after target
diff --git a/src/edu/uci/eecs/specCompiler/codeGenerator/CodeVariables.java b/src/edu/uci/eecs/specCompiler/codeGenerator/CodeVariables.java
index c9f6dde..4abd569 100644
--- a/src/edu/uci/eecs/specCompiler/codeGenerator/CodeVariables.java
+++ b/src/edu/uci/eecs/specCompiler/codeGenerator/CodeVariables.java
@@ -33,6 +33,7 @@ public class CodeVariables {
 
 	// Model checker code
 	public static final String HEADER_CDSANNOTATE = "<cdsannotate.h>";
+	public static final String HEADER_COMMON = "<common.h>";
 	public static final String HEADER_SPECANNOTATION = "<specannotation.h>";
 	public static final String HEADER_CDSTRACE = "<cdstrace.h>";
 //	public static final String CDSAnnotate = "cdsannotate";
@@ -291,6 +292,7 @@ public class CodeVariables {
 		newCode.add(INCLUDE(HEADER_STDLIB));
 		newCode.add(INCLUDE(HEADER_STDINT));
 		newCode.add(INCLUDE(HEADER_CDSANNOTATE));
+		newCode.add(INCLUDE(HEADER_COMMON));
 		newCode.add(INCLUDE(HEADER_SPEC_LIB));
 		newCode.add(INCLUDE(HEADER_SPECANNOTATION));
 		newCode.add("");
@@ -362,7 +364,7 @@ public class CodeVariables {
 		// Init func_ptr_table
 		newCode.add(COMMENT("Init func_ptr_table"));
 		newCode.add(ASSIGN("func_ptr_table",
-				"(void**) malloc(sizeof(void*) * 2)"));
+				"(void**) malloc(sizeof(void*) * " + semantics.interface2Num.size() + " * 2)"));
 		for (String interfaceName : semantics.interfaceName2Construct.keySet()) {
 			String interfaceNum = Integer.toString(semantics.interface2Num
 					.get(interfaceName));