more
authorPeizhao Ou <peizhaoo@uci.edu>
Thu, 5 Dec 2013 05:53:03 +0000 (21:53 -0800)
committerPeizhao Ou <peizhaoo@uci.edu>
Thu, 5 Dec 2013 05:53:03 +0000 (21:53 -0800)
grammer/spec_compiler.jj
src/edu/uci/eecs/specCompiler/codeGenerator/CodeVariables.java
src/edu/uci/eecs/specCompiler/codeGenerator/Environment.java
src/edu/uci/eecs/specCompiler/specExtraction/FunctionHeader.java
src/edu/uci/eecs/specCompiler/specExtraction/InterfaceDefineConstruct.java

index 24accc9e998f4db7add1c3bea0ac1501abb57112..cbe2e28d6240ab8a6853df36d0c68c7d647ce15a 100644 (file)
@@ -30,7 +30,7 @@
        
        b) Interface construct
        @Begin
-       @Interface: ...
+       @Interface_decl: ...
        @Commit_point_set:
                IDENTIFIER | IDENTIFIER ...
        @Condition: ... (Optional)
        @Begin
        @Interface_define: <Interface_Name>
        @End
+
+       g) Interface declare & define construct
+       @Begin
+       @Interface_decl_define: <Interface_Name>
+       @Commit_point_set:
+               IDENTIFIER | IDENTIFIER ...
+       @Condition: ... (Optional)
+       @HB_Condition:
+               IDENTIFIER :: <C_CPP_Condition>
+       @HB_Condition: ...
+       @ID: ... (Optional, use default ID)
+       @Check: (Optional)
+               ...
+       @Action: (Optional)
+               ...
+       @Post_action: (Optional)
+       @Post_check: (Optional)
+       @End
+
 */
 
 
@@ -564,11 +583,13 @@ String ParameterizedName() :
 
 FunctionHeader FuncDecl() :
 {
+       ArrayList<VariableDeclaration> templateList;
        String ret;
        QualifiedName funcName;
        ArrayList<VariableDeclaration> args;
 }
 {
+aa
        (<STATIC> | <INLINE>)*
        ret = Type() 
        funcName = ParseQualifiedName() 
@@ -596,22 +617,31 @@ QualifiedName ParseQualifiedName() :
        }
 }
 
-ArrayList<String> TemplateParamList() :
+ArrayList<VariableDeclaration> TemplateParamList() :
 {
-       ArrayList<String> params;
-       String str;
+       ArrayList<VariableDeclaration> params;
+       String type;
+       String name;
 }
 {
        {
-               params = new ArrayList<String>();
+               params = new ArrayList<VariableDeclaration>();
        }
        <TEMPLATE>
        "<"
-       (str = <IDENTIFIER>.image 
-       str = <IDENTIFIER>.image {params.add(str);})
+       (type = <IDENTIFIER>.image 
+       name = <IDENTIFIER>.image
+       {
+               params.add(new VariableDeclaration(type, name));
+       }
+       )
 
-       ("," str = <IDENTIFIER>.image 
-       str = <IDENTIFIER>.image {params.add(str);})*
+       ("," type = <IDENTIFIER>.image 
+       name = <IDENTIFIER>.image
+       {
+               params.add(new VariableDeclaration(type, name));
+       }
+       )*
        ">"
        {
                //System.out.println(params);
index f98250d6e163637c1efa2b45aa166c7b1112e99e..e6dfc1dae68cb5aef131ca6fc9520c5ef9fccee2 100644 (file)
@@ -482,7 +482,6 @@ public class CodeVariables {
                String interfaceName = construct.name;
                // Generate necessary header file (might be redundant but never mind)
                newCode.add(INCLUDE(HEADER_STDLIB));
-               newCode.add(INCLUDE(HEADER_THREADS));
                newCode.add(INCLUDE(HEADER_CDSANNOTATE));
                newCode.add(INCLUDE(HEADER_SPECANNOTATION));
                newCode.add(INCLUDE(HEADER_SPEC_LIB));
@@ -596,6 +595,7 @@ public class CodeVariables {
                return newCode;
        }
 
+       // Rename the interface depending on if it's declaration or definition
        public static void renameInterface(SemanticsChecker semantics,
                        Construct construct) {
                FunctionHeader header = getFunctionHeader(semantics, construct);
index 654e57974b45cb5388ba54695fea3fede47c95de..d48462aa18c201bc4948cdd8185ae65b5598e7c2 100644 (file)
@@ -4,6 +4,11 @@ public class Environment {
        public static String HOME_DIRECTORY = System.getProperty("user.dir");
        public static String GENERATED_FILE_DIR = HOME_DIRECTORY + "/" + "output";
        public static String MODEL_CHECKER_HOME_DIR = System
-                       .getProperty("user.home") + "/model-checker-priv";
+                       .getProperty("user.home") + "/test/model-checker-priv";
        public static String MODEL_CHECKER_TEST_DIR = MODEL_CHECKER_HOME_DIR + "/test";
+       
+       public static String MS_QUEUE = MODEL_CHECKER_TEST_DIR = MODEL_CHECKER_TEST_DIR + "/ms-queue";
+       public static String LINUXRWLOCKS = MODEL_CHECKER_TEST_DIR = MODEL_CHECKER_TEST_DIR + "/linuxrwlocks";
+       public static String CLIFFC_HASHTABLE = MODEL_CHECKER_TEST_DIR = MODEL_CHECKER_TEST_DIR + "/cliffc-hashtable";
+                       
 }
index f8e84bcb5508f3518ea198c15daae64c6b672c1d..60f7700c2459139a0bd042bf001547c7a8961a8a 100644 (file)
@@ -3,12 +3,15 @@ package edu.uci.eecs.specCompiler.specExtraction;
 import java.util.ArrayList;
 
 public class FunctionHeader {
+       public final ArrayList<VariableDeclaration> templateList;
+       
        public final String returnType;
        public final QualifiedName qualifiedName;
        public final ArrayList<VariableDeclaration> args;
 
-       public FunctionHeader(String returnType, QualifiedName qualifiedName,
+       public FunctionHeader(ArrayList<VariableDeclaration> templateList, String returnType, QualifiedName qualifiedName,
                        ArrayList<VariableDeclaration> args) {
+               this.templateList = templateList;
                this.returnType = returnType;
                this.qualifiedName = qualifiedName;
                this.args = args;
@@ -29,7 +32,7 @@ public class FunctionHeader {
        public FunctionHeader getRenamedHeader(String prefix) {
                String newFullName = qualifiedName.qualifiedName + prefix + "_"
                                + qualifiedName.bareName;
-               FunctionHeader newHeader = new FunctionHeader(returnType,
+               FunctionHeader newHeader = new FunctionHeader(templateList, returnType,
                                new QualifiedName(newFullName), args);
                return newHeader;
        }
index 8231c184a60fe07003974e7577ad105071bb3c5a..657b2707d2924f6b7d559eca3bab76b9384b7925 100644 (file)
@@ -4,7 +4,6 @@ import java.io.File;
 
 public class InterfaceDefineConstruct extends Construct {
        public final String name;
-       private String funcDecl;
 
        public InterfaceDefineConstruct(File file, int beginLineNum, String name) {
                super(file, beginLineNum);