edits
[cdsspec-compiler.git] / src / edu / uci / eecs / codeGenerator / CodeGenerator.java
index 5ad8cdc..a86c2cb 100644 (file)
@@ -13,6 +13,7 @@ import java.util.HashMap;
 import edu.uci.eecs.codeGenerator.CodeAdditions.CodeAddition;
 import edu.uci.eecs.specExtraction.Code;
 import edu.uci.eecs.specExtraction.Construct;
+import edu.uci.eecs.specExtraction.DefineConstruct;
 import edu.uci.eecs.specExtraction.EntryConstruct;
 import edu.uci.eecs.specExtraction.InterfaceConstruct;
 import edu.uci.eecs.specExtraction.OPConstruct;
@@ -102,6 +103,8 @@ public class CodeGenerator {
                        // Extract all the additions
                        ArrayList<OPConstruct> OPList = extractor.OPListMap.get(file);
                        EntryConstruct entry = extractor.entryMap.get(file);
+                       ArrayList<DefineConstruct> defineList = extractor.defineListMap
+                                       .get(file);
                        ArrayList<InterfaceConstruct> interfaceList = extractor.interfaceListMap
                                        .get(file);
                        Code code = null;
@@ -120,6 +123,15 @@ public class CodeGenerator {
                                addition = new CodeAddition(entry.beginLineNum, code);
                                additions.addCodeAddition(addition);
                        }
+                       // For define constructs
+                       if (defineList != null) {
+                               for (DefineConstruct con : defineList) {
+                                       code = CodeGeneratorUtils.Generate4Define(con);
+                                       addition = new CodeAddition(con.endLineNum,
+                                                       code);
+                                       additions.addCodeAddition(addition);
+                               }
+                       }
                        // For interface constructs
                        if (interfaceList != null) {
                                for (InterfaceConstruct con : interfaceList) {
@@ -306,7 +318,9 @@ public class CodeGenerator {
        }
 
        static public void main(String[] args) {
-               String[] dirNames = { Environment.REGISTER, Environment.MS_QUEUE, Environment.LINUXRWLOCKS, Environment.MCS_LOCK, Environment.DEQUE };
+               String[] dirNames = { Environment.REGISTER, Environment.MS_QUEUE,
+                               Environment.LINUXRWLOCKS, Environment.MCS_LOCK,
+                               Environment.DEQUE };
 
                for (int i = 0; i < dirNames.length; i++) {
                        String dirName = dirNames[i];