Replace all tab to spaces.
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 26 May 2006 02:05:28 +0000 (02:05 +0000)
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 26 May 2006 02:05:28 +0000 (02:05 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@287 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java
Tools/Source/GenBuild/org/tianocore/build/pcd/action/PCDAutoGenAction.java
Tools/Source/GenBuild/org/tianocore/build/pcd/entity/MemoryDatabaseManager.java
Tools/Source/GenBuild/org/tianocore/build/pcd/entity/Token.java

index da98801..6cc73ff 100644 (file)
@@ -48,19 +48,19 @@ import org.tianocore.build.pcd.exception.EntityException;
 \r
 class StringTable {\r
     private ArrayList<String>   al; \r
-               private ArrayList<String>   alComments;\r
+    private ArrayList<String>   alComments;\r
     private String              phase;\r
     int                         len; \r
-               int                                                                                                     bodyStart;\r
-               int                                                                                                     bodyLineNum;\r
+    int                         bodyStart;\r
+    int                         bodyLineNum;\r
 \r
     public StringTable (String phase) {\r
         this.phase = phase;\r
         al = new ArrayList<String>();\r
-                               alComments = new ArrayList<String>();\r
+        alComments = new ArrayList<String>();\r
         len = 0;\r
-                               bodyStart = 0;\r
-                               bodyLineNum = 0;\r
+        bodyStart = 0;\r
+        bodyLineNum = 0;\r
     }\r
 \r
     public String getSizeMacro () {\r
@@ -68,15 +68,15 @@ class StringTable {
     }\r
 \r
     private int getSize () {\r
-                               //\r
-                               // We have at least one Unicode Character in the table.\r
-                               //\r
+        //\r
+        // We have at least one Unicode Character in the table.\r
+        //\r
         return len == 0 ? 1 : len;\r
     }\r
 \r
-               public int getTableLen () {\r
-                               return al.size() == 0 ? 1 : al.size();\r
-               }\r
+    public int getTableLen () {\r
+        return al.size() == 0 ? 1 : al.size();\r
+    }\r
 \r
     public String getExistanceMacro () {\r
         return String.format(PcdDatabase.StringTableExistenceMacro, phase, (al.size() == 0)? "TRUE":"FALSE");\r
@@ -84,53 +84,53 @@ class StringTable {
 \r
     public String getTypeDeclaration () {\r
 \r
-                               String output;\r
+        String output;\r
 \r
-                               final String stringTable = "StringTable";\r
-                               final String tab = "\t";\r
-                               final String newLine = ";\r\n";\r
+        final String stringTable = "StringTable";\r
+        final String tab = "\t";\r
+        final String newLine = ";\r\n";\r
 \r
-                               output =  "/* StringTable */\r\n";\r
+        output =  "/* StringTable */\r\n";\r
 \r
-                               if (al.size() == 0) {\r
-                                               output += tab + String.format("UINT16 %s[1] /* StringTable is Empty */", stringTable) + newLine;\r
-                               }\r
+        if (al.size() == 0) {\r
+            output += tab + String.format("UINT16 %s[1] /* StringTable is Empty */", stringTable) + newLine;\r
+        }\r
 \r
-                               for (int i = 0; i < al.size(); i++) {\r
-                                               String str = al.get(i);\r
+        for (int i = 0; i < al.size(); i++) {\r
+            String str = al.get(i);\r
 \r
-                                               if (i == 0) {\r
-                                                               //\r
-                                                               // StringTable is a well-known name in the PCD DXE driver\r
-                                                               //\r
-                                                               output += tab + String.format("UINT16                   %s[%d] /* %s */", stringTable, str.length() + 1, alComments.get(i)) + newLine;\r
-                                               } else {\r
-                                                               output += tab + String.format("UINT16                   %s_%d[%d] /* %s */", stringTable, i, str.length() + 1, alComments.get(i)) + newLine;\r
-                                               }\r
-                               }\r
+            if (i == 0) {\r
+                //\r
+                // StringTable is a well-known name in the PCD DXE driver\r
+                //\r
+                output += tab + String.format("UINT16       %s[%d] /* %s */", stringTable, str.length() + 1, alComments.get(i)) + newLine;\r
+            } else {\r
+                output += tab + String.format("UINT16       %s_%d[%d] /* %s */", stringTable, i, str.length() + 1, alComments.get(i)) + newLine;\r
+            }\r
+        }\r
 \r
-                               return output;\r
+        return output;\r
 \r
     }\r
 \r
     public ArrayList<String> getInstantiation () {\r
-                               ArrayList<String> output = new ArrayList<String>();\r
+        ArrayList<String> output = new ArrayList<String>();\r
 \r
-                               output.add("/* StringTable */"); \r
+        output.add("/* StringTable */"); \r
 \r
-                               if (al.size() == 0) {\r
-                                               output.add("{ 0 }");\r
-                               } else {\r
-                                               String str;\r
+        if (al.size() == 0) {\r
+            output.add("{ 0 }");\r
+        } else {\r
+            String str;\r
 \r
-                                               for (int i = 0; i < al.size(); i++) {\r
-                                                               str = String.format("L\"%s\" /* %s */", al.get(i), alComments.get(i));\r
-                                                               if (i != al.size() - 1) {\r
-                                                                               str += ",";\r
-                                                               }\r
-                                                               output.add(str);\r
-                                               }\r
-                               }\r
+            for (int i = 0; i < al.size(); i++) {\r
+                str = String.format("L\"%s\" /* %s */", al.get(i), alComments.get(i));\r
+                if (i != al.size() - 1) {\r
+                    str += ",";\r
+                }\r
+                output.add(str);\r
+            }\r
+        }\r
 \r
         return output;\r
     }\r
@@ -144,7 +144,7 @@ class StringTable {
         //\r
         len += str.length() + 1; \r
         al.add(str);\r
-                               alComments.add(token.getPrimaryKeyString());\r
+        alComments.add(token.getPrimaryKeyString());\r
 \r
         return i;\r
     }\r
@@ -152,19 +152,19 @@ class StringTable {
 \r
 class SizeTable {\r
     private ArrayList<Integer>  al;\r
-               private ArrayList<String>   alComments;\r
+    private ArrayList<String>   alComments;\r
     private String              phase;\r
     private int                 len;\r
-               private int                                                     bodyStart;\r
-               private int                                                     bodyLineNum;\r
+    private int             bodyStart;\r
+    private int             bodyLineNum;\r
 \r
     public SizeTable (String phase) {\r
         this.phase = phase;\r
         al = new ArrayList<Integer>();\r
-                               alComments = new ArrayList<String>();\r
+        alComments = new ArrayList<String>();\r
         len = 0;\r
-                               bodyStart = 0;\r
-                               bodyLineNum = 0;\r
+        bodyStart = 0;\r
+        bodyLineNum = 0;\r
     }\r
 \r
     public String getTypeDeclaration () {\r
@@ -172,85 +172,85 @@ class SizeTable {
     }\r
 \r
     public ArrayList<String> getInstantiation () {\r
-                               ArrayList<String> Output = new ArrayList<String>();\r
+        ArrayList<String> Output = new ArrayList<String>();\r
 \r
         Output.add("/* SizeTable */");\r
         Output.add("{");\r
-                               bodyStart = 2;\r
-\r
-                               if (al.size() == 0) {\r
-                                               Output.add("0");\r
-                               } else {\r
-                                               for (int index = 0; index < al.size(); index++) {\r
-                                                               Integer n = al.get(index);\r
-                                                               String str = n.toString();\r
-\r
-                                                               if (index != (al.size() - 1)) {\r
-                                                                               str += ",";\r
-                                                               }\r
-\r
-                                                               str += " /* " + alComments.get(index) + " */"; \r
-                                                               Output.add(str);\r
-                                                               bodyLineNum++;\r
-               \r
-                                               }\r
-                               }\r
-                               Output.add("}");\r
+        bodyStart = 2;\r
+\r
+        if (al.size() == 0) {\r
+            Output.add("0");\r
+        } else {\r
+            for (int index = 0; index < al.size(); index++) {\r
+                Integer n = al.get(index);\r
+                String str = n.toString();\r
+\r
+                if (index != (al.size() - 1)) {\r
+                    str += ",";\r
+                }\r
+\r
+                str += " /* " + alComments.get(index) + " */"; \r
+                Output.add(str);\r
+                bodyLineNum++;\r
+    \r
+            }\r
+        }\r
+        Output.add("}");\r
 \r
         return Output;\r
     }\r
 \r
-               public int getBodyStart() {\r
-                               return bodyStart;\r
-               }\r
+    public int getBodyStart() {\r
+        return bodyStart;\r
+    }\r
 \r
-               public int getBodyLineNum () {\r
-                               return bodyLineNum;\r
-               }\r
+    public int getBodyLineNum () {\r
+        return bodyLineNum;\r
+    }\r
 \r
     public int add (Token token) {\r
         int index = len;\r
 \r
         len++; \r
         al.add(token.datumSize);\r
-                               alComments.add(token.getPrimaryKeyString());\r
+        alComments.add(token.getPrimaryKeyString());\r
 \r
         return index;\r
     }\r
 \r
-               private int getDatumSize(Token token) {\r
-                               /*\r
-                               switch (token.datumType) {\r
-                               case Token.DATUM_TYPE.UINT8:\r
-                                               return 1;\r
-                               default:\r
-                                               return 0;\r
-                               }\r
-                               */\r
-                               return 0;\r
-               }\r
+    private int getDatumSize(Token token) {\r
+        /*\r
+        switch (token.datumType) {\r
+        case Token.DATUM_TYPE.UINT8:\r
+            return 1;\r
+        default:\r
+            return 0;\r
+        }\r
+        */\r
+        return 0;\r
+    }\r
 \r
-               public int getTableLen () {\r
-                               return al.size() == 0 ? 1 : al.size();\r
-               }\r
+    public int getTableLen () {\r
+        return al.size() == 0 ? 1 : al.size();\r
+    }\r
 \r
 }\r
 \r
 class GuidTable {\r
     private ArrayList<UUID> al;\r
-               private ArrayList<String> alComments;\r
+    private ArrayList<String> alComments;\r
     private String          phase;\r
     private int             len;\r
-               private int                                                     bodyStart;\r
-               private int                                                     bodyLineNum;\r
+    private int             bodyStart;\r
+    private int             bodyLineNum;\r
 \r
     public GuidTable (String phase) {\r
         this.phase = phase;\r
         al = new ArrayList<UUID>();\r
-                               alComments = new ArrayList<String>();\r
+        alComments = new ArrayList<String>();\r
         len = 0;\r
-                               bodyStart = 0;\r
-                               bodyLineNum = 0;\r
+        bodyStart = 0;\r
+        bodyLineNum = 0;\r
     }\r
 \r
     public String getSizeMacro () {\r
@@ -269,60 +269,60 @@ class GuidTable {
         return String.format(PcdDatabase.GuidTableDeclaration, phase);\r
     }\r
 \r
-               private String getUuidCString (UUID uuid) {\r
-                               String[]  guidStrArray;\r
-\r
-                               guidStrArray =(uuid.toString()).split("-");\r
-\r
-                               return String.format("{ 0x%s, 0x%s, 0x%s, { 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s } }",\r
-                                                                                                                                                                guidStrArray[0],\r
-                                                                                                                                                                guidStrArray[1],\r
-                                                                                                                                                                guidStrArray[2],\r
-                                                                                                                                                               (guidStrArray[3].substring(0, 2)),\r
-                                                                                                                                                               (guidStrArray[3].substring(2, 4)),\r
-                                                                                                                                                               (guidStrArray[4].substring(0, 2)),\r
-                                                                                                                                                               (guidStrArray[4].substring(2, 4)),\r
-                                                                                                                                                               (guidStrArray[4].substring(4, 6)),\r
-                                                                                                                                                               (guidStrArray[4].substring(6, 8)),\r
-                                                                                                                                                               (guidStrArray[4].substring(8, 10)),\r
-                                                                                                                                                               (guidStrArray[4].substring(10, 12))\r
-                                                                                                                                                               );\r
-               }\r
+    private String getUuidCString (UUID uuid) {\r
+        String[]  guidStrArray;\r
+\r
+        guidStrArray =(uuid.toString()).split("-");\r
+\r
+        return String.format("{ 0x%s, 0x%s, 0x%s, { 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s } }",\r
+                                         guidStrArray[0],\r
+                                         guidStrArray[1],\r
+                                         guidStrArray[2],\r
+                                        (guidStrArray[3].substring(0, 2)),\r
+                                        (guidStrArray[3].substring(2, 4)),\r
+                                        (guidStrArray[4].substring(0, 2)),\r
+                                        (guidStrArray[4].substring(2, 4)),\r
+                                        (guidStrArray[4].substring(4, 6)),\r
+                                        (guidStrArray[4].substring(6, 8)),\r
+                                        (guidStrArray[4].substring(8, 10)),\r
+                                        (guidStrArray[4].substring(10, 12))\r
+                                        );\r
+    }\r
 \r
     public ArrayList<String> getInstantiation () {\r
-                               ArrayList<String> Output = new ArrayList<String>();\r
+        ArrayList<String> Output = new ArrayList<String>();\r
 \r
         Output.add("/* GuidTable */");\r
         Output.add("{");\r
-                               bodyStart = 2;\r
+        bodyStart = 2;\r
 \r
-                               if (al.size() == 0) {\r
-                                               Output.add(getUuidCString(new UUID(0, 0)));\r
-                               }\r
+        if (al.size() == 0) {\r
+            Output.add(getUuidCString(new UUID(0, 0)));\r
+        }\r
         \r
         for (Object u : al) {\r
             UUID uuid = (UUID)u;\r
-                                               String str = getUuidCString(uuid);\r
+            String str = getUuidCString(uuid);\r
 \r
-                                               if (al.indexOf(u) != (al.size() - 1)) {\r
-                                                               str += ",";\r
-                                               }\r
+            if (al.indexOf(u) != (al.size() - 1)) {\r
+                str += ",";\r
+            }\r
             Output.add(str);\r
-                                               bodyLineNum++;\r
+            bodyLineNum++;\r
 \r
         }\r
-                               Output.add("}");\r
+        Output.add("}");\r
 \r
         return Output;\r
     }\r
 \r
-               public int getBodyStart() {\r
-                               return bodyStart;\r
-               }\r
+    public int getBodyStart() {\r
+        return bodyStart;\r
+    }\r
 \r
-               public int getBodyLineNum () {\r
-                               return bodyLineNum;\r
-               }\r
+    public int getBodyLineNum () {\r
+        return bodyLineNum;\r
+    }\r
 \r
     public int add (UUID uuid, String name) {\r
         int index = len;\r
@@ -335,26 +335,26 @@ class GuidTable {
         return index;\r
     }\r
 \r
-               public int getTableLen () {\r
-                               return al.size() == 0 ? 0 : al.size();\r
-               }\r
+    public int getTableLen () {\r
+        return al.size() == 0 ? 0 : al.size();\r
+    }\r
 \r
 }\r
 \r
 class SkuIdTable {\r
     private ArrayList<Integer[]> al;\r
-               private ArrayList<String>    alComment;\r
+    private ArrayList<String>    alComment;\r
     private String               phase;\r
     private int                  len;\r
-               private int                                                                             bodyStart;\r
-               private int                                                                             bodyLineNum;\r
+    private int                   bodyStart;\r
+    private int                   bodyLineNum;\r
 \r
     public SkuIdTable (String phase) {\r
         this.phase = phase;\r
         al = new ArrayList<Integer[]>();\r
-                               alComment = new ArrayList<String>();\r
-                               bodyStart = 0;\r
-                               bodyLineNum = 0;\r
+        alComment = new ArrayList<String>();\r
+        bodyStart = 0;\r
+        bodyLineNum = 0;\r
         len = 0;\r
     }\r
 \r
@@ -375,82 +375,82 @@ class SkuIdTable {
     }\r
 \r
     public ArrayList<String> getInstantiation () {\r
-                               ArrayList<String> Output = new ArrayList<String> ();\r
+        ArrayList<String> Output = new ArrayList<String> ();\r
 \r
         Output.add("/* SkuIdTable */");\r
         Output.add("{");\r
-                               bodyStart = 2;\r
+        bodyStart = 2;\r
 \r
-                               if (al.size() == 0) {\r
-                                               Output.add("0");\r
-                               }\r
+        if (al.size() == 0) {\r
+            Output.add("0");\r
+        }\r
         \r
         for (int index = 0; index < al.size(); index++) {\r
-                                               String str;\r
+            String str;\r
 \r
-                                               str = "/* " + alComment.get(index) + "*/ ";\r
-                                               str += "/* MaxSku */ ";\r
+            str = "/* " + alComment.get(index) + "*/ ";\r
+            str += "/* MaxSku */ ";\r
 \r
 \r
-                                               Integer[] ia = al.get(index);\r
+            Integer[] ia = al.get(index);\r
 \r
-                                               str += ia[0].toString() + ", ";\r
-                                               for (int index2 = 1; index2 < ia.length; index2++) {\r
-                                                        str += ia[index2].toString();\r
-                                                        if (index != al.size() - 1) {\r
-                                                                        str += ", ";\r
-                                                        }\r
-                                               }\r
+            str += ia[0].toString() + ", ";\r
+            for (int index2 = 1; index2 < ia.length; index2++) {\r
+               str += ia[index2].toString();\r
+               if (index != al.size() - 1) {\r
+                   str += ", ";\r
+               }\r
+            }\r
 \r
             Output.add(str);\r
-                                               bodyLineNum++;\r
+            bodyLineNum++;\r
 \r
         }\r
 \r
-                               Output.add("}");\r
+        Output.add("}");\r
 \r
         return Output;\r
     }\r
 \r
     public int add (Token token) {\r
 \r
-                               int index;\r
+        int index;\r
 \r
-                               Integer [] skuIds = new Integer[token.maxSkuCount + 1];\r
-                               skuIds[0] = new Integer(token.maxSkuCount);\r
-                               for (index = 1; index < skuIds.length; index++) {\r
-                                               skuIds[index] = new Integer(token.skuData.get(index - 1).id);\r
-                               }\r
+        Integer [] skuIds = new Integer[token.maxSkuCount + 1];\r
+        skuIds[0] = new Integer(token.maxSkuCount);\r
+        for (index = 1; index < skuIds.length; index++) {\r
+            skuIds[index] = new Integer(token.skuData.get(index - 1).id);\r
+        }\r
 \r
         index = len;\r
 \r
         len += skuIds.length; \r
         al.add(skuIds);\r
-                               alComment.add(token.getPrimaryKeyString());\r
+        alComment.add(token.getPrimaryKeyString());\r
 \r
         return index;\r
     }\r
 \r
-               public int getTableLen () {\r
-                               return al.size() == 0 ? 1 : al.size();\r
-               }\r
+    public int getTableLen () {\r
+        return al.size() == 0 ? 1 : al.size();\r
+    }\r
 \r
 }\r
 \r
 class LocalTokenNumberTable {\r
     private ArrayList<String>    al;\r
-               private ArrayList<String>    alComment;\r
+    private ArrayList<String>    alComment;\r
     private String               phase;\r
     private int                  len;\r
-               private int                                                                     bodyStart;\r
-               private int                                                                             bodyLineNum;\r
+    private int                   bodyStart;\r
+    private int                   bodyLineNum;\r
 \r
     public LocalTokenNumberTable (String phase) {\r
         this.phase = phase;\r
         al = new ArrayList<String>();\r
-                               alComment = new ArrayList<String>();\r
-                               bodyStart = 0;\r
-                               bodyLineNum = 0;\r
+        alComment = new ArrayList<String>();\r
+        bodyStart = 0;\r
+        bodyLineNum = 0;\r
 \r
         len = 0;\r
     }\r
@@ -472,65 +472,65 @@ class LocalTokenNumberTable {
     }\r
 \r
     public ArrayList<String> getInstantiation () {\r
-                               ArrayList<String> output = new ArrayList<String>();\r
+        ArrayList<String> output = new ArrayList<String>();\r
 \r
         output.add("/* LocalTokenNumberTable */");\r
         output.add("{");\r
-                               bodyStart = 2;\r
+        bodyStart = 2;\r
 \r
-                               if (al.size() == 0) {\r
-                                               output.add("0");\r
-                               }\r
+        if (al.size() == 0) {\r
+            output.add("0");\r
+        }\r
         \r
         for (int index = 0; index < al.size(); index++) {\r
-                                               String str;\r
+            String str;\r
 \r
-                                               str = (String)al.get(index);\r
+            str = (String)al.get(index);\r
 \r
-                                               str += " /* " + alComment.get(index) + " */ ";\r
+            str += " /* " + alComment.get(index) + " */ ";\r
 \r
 \r
-                                               if (index != (al.size() - 1)) {\r
-                                                               str += ",";\r
-                                               }\r
+            if (index != (al.size() - 1)) {\r
+                str += ",";\r
+            }\r
 \r
             output.add(str);\r
 \r
         }\r
 \r
-                               bodyLineNum = al.size();\r
+        bodyLineNum = al.size();\r
 \r
-                               output.add("}");\r
+        output.add("}");\r
 \r
         return output;\r
     }\r
 \r
     public int add (Token token) {\r
         int index = len;\r
-                               String str;\r
+        String str;\r
 \r
         len++; \r
 \r
-                               str =  String.format(PcdDatabase.offsetOfStrTemplate, phase, token.hasDefaultValue() ? "Init" : "Uninit", token.getPrimaryKeyString());\r
+        str =  String.format(PcdDatabase.offsetOfStrTemplate, phase, token.hasDefaultValue() ? "Init" : "Uninit", token.getPrimaryKeyString());\r
 \r
-                               if (token.isStringType()) {\r
-                                               str += " | PCD_TYPE_STRING";\r
-                               }\r
+        if (token.isStringType()) {\r
+            str += " | PCD_TYPE_STRING";\r
+        }\r
 \r
-                               if (token.skuEnabled) {\r
-                                               str += " | PCD_TYPE_SKU_ENABLED";\r
-                               }\r
+        if (token.skuEnabled) {\r
+            str += " | PCD_TYPE_SKU_ENABLED";\r
+        }\r
 \r
-                               if (token.hiiEnabled) {\r
-                                               str += " | PCD_TYPE_HII";\r
-                               }\r
+        if (token.hiiEnabled) {\r
+            str += " | PCD_TYPE_HII";\r
+        }\r
 \r
-                               if (token.vpdEnabled) {\r
-                                               str += " | PCD_TYPE_VPD";\r
-                               }\r
-                               \r
+        if (token.vpdEnabled) {\r
+            str += " | PCD_TYPE_VPD";\r
+        }\r
+        \r
         al.add(str);\r
-                               alComment.add(token.getPrimaryKeyString());\r
+        alComment.add(token.getPrimaryKeyString());\r
 \r
         return index;\r
     }\r
@@ -538,38 +538,38 @@ class LocalTokenNumberTable {
 \r
 class ExMapTable {\r
 \r
-               class ExTriplet {\r
-                               public Integer guidTableIdx;\r
-                               public Long exTokenNumber;\r
-                               public Long localTokenIdx;\r
-               \r
-                               public ExTriplet (int guidTableIdx, long exTokenNumber, long localTokenIdx) {\r
-                                               this.guidTableIdx = new Integer(guidTableIdx);\r
-                                               this.exTokenNumber = new Long(exTokenNumber);\r
-                                               this.localTokenIdx = new Long(localTokenIdx);\r
-                               }\r
-               }\r
+    class ExTriplet {\r
+        public Integer guidTableIdx;\r
+        public Long exTokenNumber;\r
+        public Long localTokenIdx;\r
+    \r
+        public ExTriplet (int guidTableIdx, long exTokenNumber, long localTokenIdx) {\r
+            this.guidTableIdx = new Integer(guidTableIdx);\r
+            this.exTokenNumber = new Long(exTokenNumber);\r
+            this.localTokenIdx = new Long(localTokenIdx);\r
+        }\r
+    }\r
 \r
     private ArrayList<ExTriplet> al;\r
-               private ArrayList<String>    alComment;\r
+    private ArrayList<String>    alComment;\r
     private String               phase;\r
     private int                  len;\r
-               private int                                                                             bodyStart;\r
-               private int                                                                             bodyLineNum;\r
-               private int                                                                             base;\r
+    private int                   bodyStart;\r
+    private int                   bodyLineNum;\r
+    private int                   base;\r
 \r
     public ExMapTable (String phase) {\r
         this.phase = phase;\r
         al = new ArrayList<ExTriplet>();\r
-                               alComment = new ArrayList<String>();\r
-                               bodyStart = 0;\r
-                               bodyLineNum = 0;\r
+        alComment = new ArrayList<String>();\r
+        bodyStart = 0;\r
+        bodyLineNum = 0;\r
         len = 0;\r
     }\r
 \r
     public String getSizeMacro () {\r
         return String.format(PcdDatabase.ExMapTableSizeMacro, phase, getTableLen())\r
-                                                + String.format(PcdDatabase.ExTokenNumber, phase, al.size());\r
+             + String.format(PcdDatabase.ExTokenNumber, phase, al.size());\r
     }\r
 \r
     private int getSize () {\r
@@ -585,38 +585,38 @@ class ExMapTable {
     }\r
 \r
     public ArrayList<String> getInstantiation () {\r
-                               ArrayList<String> Output = new ArrayList<String>();\r
+        ArrayList<String> Output = new ArrayList<String>();\r
 \r
         Output.add("/* ExMapTable */");\r
         Output.add("{");\r
-                               bodyStart = 2;\r
+        bodyStart = 2;\r
 \r
-                               if (al.size() == 0) {\r
-                                               Output.add("{0, 0, 0}");\r
-                               }\r
+        if (al.size() == 0) {\r
+            Output.add("{0, 0, 0}");\r
+        }\r
         \r
-                               int index;\r
+        int index;\r
         for (index = 0; index < al.size(); index++) {\r
-                                               String str;\r
+            String str;\r
 \r
-                                               ExTriplet e = (ExTriplet)al.get(index);\r
+            ExTriplet e = (ExTriplet)al.get(index);\r
 \r
-                                               str = "{ " + e.exTokenNumber.toString() + ", ";\r
-                                               str += e.localTokenIdx.toString() + ", ";\r
-                                               str += e.guidTableIdx.toString();\r
+            str = "{ " + e.exTokenNumber.toString() + ", ";\r
+            str += e.localTokenIdx.toString() + ", ";\r
+            str += e.guidTableIdx.toString();\r
 \r
-                                               str += " /* " + alComment.get(index) + " */";\r
+            str += " /* " + alComment.get(index) + " */";\r
 \r
-                                               if (index != al.size() - 1) {\r
-                                                               str += ",";\r
-                                               }\r
+            if (index != al.size() - 1) {\r
+                str += ",";\r
+            }\r
 \r
             Output.add(str);\r
-                                               bodyLineNum++;\r
+            bodyLineNum++;\r
 \r
         }\r
 \r
-                               Output.add("}");\r
+        Output.add("}");\r
 \r
         return Output;\r
     }\r
@@ -626,14 +626,14 @@ class ExMapTable {
 \r
         len++; \r
         al.add(new ExTriplet(guidTableIdx, exTokenNum, localTokenIdx));\r
-                               alComment.add(name);\r
+        alComment.add(name);\r
 \r
         return index;\r
     }\r
 \r
-               public int getTableLen () {\r
-                               return al.size() == 0 ? 1 : al.size();\r
-               }\r
+    public int getTableLen () {\r
+        return al.size() == 0 ? 1 : al.size();\r
+    }\r
 \r
 }\r
 \r
@@ -648,7 +648,7 @@ class PcdDatabase {
 \r
 \r
     public final static String ExMapTableSizeMacro              = "#define %s_EXMAPPING_TABLE_SIZE  %d\r\n";\r
-               public final static String ExTokenNumber                                                                                = "#define %s_EX_TOKEN_NUMBER                           %d\r\n";\r
+    public final static String ExTokenNumber                    = "#define %s_EX_TOKEN_NUMBER       %d\r\n";\r
     public final static String GuidTableSizeMacro               = "#define %s_GUID_TABLE_SIZE         %d\r\n";\r
     public final static String LocalTokenNumberTableSizeMacro   = "#define %s_LOCAL_TOKEN_NUMBER            %d\r\n";\r
     public final static String StringTableSizeMacro             = "#define %s_STRING_TABLE_SIZE       %d\r\n";\r
@@ -661,461 +661,461 @@ class PcdDatabase {
     public final static String StringTableExistenceMacro        = "#define %s_STRING_TABLE_EMPTY   %s\r\n";\r
     public final static String SkuTableExistenceMacro           = "#define %s_SKUID_TABLE_EMPTY    %s\r\n";\r
 \r
-               public final static String offsetOfSkuHeadStrTemplate                   = "offsetof(%s_PCD_DATABASE, %s.%s_SkuDataTable)";\r
-               public final static String offsetOfStrTemplate              = "offsetof(%s_PCD_DATABASE, %s.%s)";\r
+    public final static String offsetOfSkuHeadStrTemplate       = "offsetof(%s_PCD_DATABASE, %s.%s_SkuDataTable)";\r
+    public final static String offsetOfStrTemplate              = "offsetof(%s_PCD_DATABASE, %s.%s)";\r
 \r
-               private StringTable stringTable;\r
-               private GuidTable               guidTable;\r
-               private LocalTokenNumberTable localTokenNumberTable;\r
-               private SkuIdTable      skuIdTable;\r
-               private SizeTable   sizeTable;\r
-               private ExMapTable  exMapTable;\r
+    private StringTable stringTable;\r
+    private GuidTable   guidTable;\r
+    private LocalTokenNumberTable localTokenNumberTable;\r
+    private SkuIdTable  skuIdTable;\r
+    private SizeTable   sizeTable;\r
+    private ExMapTable  exMapTable;\r
 \r
-               private ArrayList<Token> alTokens;\r
-               private String phase;\r
-               private int assignedTokenNumber;\r
+    private ArrayList<Token> alTokens;\r
+    private String phase;\r
+    private int assignedTokenNumber;\r
 \r
-               private String hString;\r
-               private String cString;\r
+    private String hString;\r
+    private String cString;\r
 \r
 \r
-               class AlignmentSizeComp implements Comparator<Token> {\r
+    class AlignmentSizeComp implements Comparator<Token> {\r
         public int compare (Token a, Token b) {\r
-                                               return getAlignmentSize(b) \r
-                                                                               - getAlignmentSize(a);\r
-                               }\r
-               }\r
-\r
-               public PcdDatabase (ArrayList<Token> alTokens, String exePhase, int startLen) {\r
-                        phase = exePhase;\r
-\r
-                        stringTable = new StringTable(phase);\r
-                        guidTable = new GuidTable(phase);\r
-                        localTokenNumberTable = new LocalTokenNumberTable(phase);\r
-                        skuIdTable = new SkuIdTable(phase);\r
-                        sizeTable = new SizeTable(phase);\r
-                        exMapTable = new ExMapTable(phase); \r
-\r
-                        assignedTokenNumber = startLen;\r
-                        this.alTokens = alTokens;\r
-               }\r
-\r
-               private void getTwoGroupsOfTokens (ArrayList<Token> alTokens, List<Token> initTokens, List<Token> uninitTokens) {\r
-                               for (int i = 0; i < alTokens.size(); i++) {\r
-                                               Token t = (Token)alTokens.get(i);\r
-                                               if (t.hasDefaultValue()) {\r
-                                                               initTokens.add(t);\r
-                                               } else {\r
-                                                               uninitTokens.add(t);\r
-                                               }\r
-                               }\r
-\r
-                               return;\r
-               }\r
-\r
-               private int getAlignmentSize (Token token) {\r
-                               if (token.hiiEnabled) {\r
-                                               return 2;\r
-                               }\r
-\r
-                               if (token.vpdEnabled) {\r
-                                               return 4;\r
-                               }\r
-\r
-                               if (token.isStringType()) {\r
-                                               return 2;\r
-                               }\r
-\r
-                               switch (token.datumType) {\r
-                                               case UINT8:\r
-                                                               return 1;\r
-                                               case UINT16:\r
-                                                               return 2;\r
-                                               case UINT32:\r
-                                                               return 4;\r
-                                               case UINT64:\r
-                                                               return 8;\r
-                                               case POINTER:\r
-                                                               return 1;\r
-                                               case BOOLEAN:\r
-                                                               return 1;\r
-                                               }\r
-                                               return 1;\r
-                }\r
-\r
-               public String getCString () {\r
-                               return cString;\r
-               }\r
-\r
-               public String getHString () {\r
-                               return hString;\r
-               }\r
+            return getAlignmentSize(b) \r
+                    - getAlignmentSize(a);\r
+        }\r
+    }\r
+\r
+    public PcdDatabase (ArrayList<Token> alTokens, String exePhase, int startLen) {\r
+       phase = exePhase;\r
+\r
+       stringTable = new StringTable(phase);\r
+       guidTable = new GuidTable(phase);\r
+       localTokenNumberTable = new LocalTokenNumberTable(phase);\r
+       skuIdTable = new SkuIdTable(phase);\r
+       sizeTable = new SizeTable(phase);\r
+       exMapTable = new ExMapTable(phase); \r
+\r
+       assignedTokenNumber = startLen;\r
+       this.alTokens = alTokens;\r
+    }\r
+\r
+    private void getTwoGroupsOfTokens (ArrayList<Token> alTokens, List<Token> initTokens, List<Token> uninitTokens) {\r
+        for (int i = 0; i < alTokens.size(); i++) {\r
+            Token t = (Token)alTokens.get(i);\r
+            if (t.hasDefaultValue()) {\r
+                initTokens.add(t);\r
+            } else {\r
+                uninitTokens.add(t);\r
+            }\r
+        }\r
+\r
+        return;\r
+    }\r
+\r
+    private int getAlignmentSize (Token token) {\r
+        if (token.hiiEnabled) {\r
+            return 2;\r
+        }\r
+\r
+        if (token.vpdEnabled) {\r
+            return 4;\r
+        }\r
+\r
+        if (token.isStringType()) {\r
+            return 2;\r
+        }\r
+\r
+        switch (token.datumType) {\r
+            case UINT8:\r
+                return 1;\r
+            case UINT16:\r
+                return 2;\r
+            case UINT32:\r
+                return 4;\r
+            case UINT64:\r
+                return 8;\r
+            case POINTER:\r
+                return 1;\r
+            case BOOLEAN:\r
+                return 1;\r
+            }\r
+            return 1;\r
+     }\r
+\r
+    public String getCString () {\r
+        return cString;\r
+    }\r
+\r
+    public String getHString () {\r
+        return hString;\r
+    }\r
 \r
      public void genCode () {\r
 \r
-                               final String newLine                        = "\r\n";\r
-                               final String instNewLine                                                                                = "\\\r\n";\r
-                               final String declNewLine                    = ";\r\n";\r
-                               final String tab                            = "\t";\r
-                               final String commaInstNewLine                                                                           = "\t,\\\r\n";\r
-                               final String commaNewLine                                                                               = ", \r\n";\r
-\r
-                               int i;\r
-                               ArrayList<String> decla;\r
-                               ArrayList<String> inst;\r
-\r
-                               String macroStr   = "";\r
-                               String initDeclStr = "";\r
-                               String initInstStr = "";\r
-                               String uninitDeclStr = "";\r
-\r
-                               List<Token> initTokens = new ArrayList<Token> ();\r
-                               List<Token> uninitTokens = new ArrayList<Token> ();\r
-                               \r
-                               HashMap <String, ArrayList<String>> initCode = new HashMap<String, ArrayList<String>> ();\r
-                               HashMap <String, ArrayList<String>> uninitCode = new HashMap<String, ArrayList<String>> ();\r
-\r
-                               getTwoGroupsOfTokens (alTokens, initTokens, uninitTokens);\r
-\r
-                               //\r
-                               // Generate Structure Declaration for PcdTokens without Default Value\r
-                               // PEI_PCD_DATABASE_INIT\r
-                               //\r
-                               java.util.Comparator comparator = new AlignmentSizeComp();\r
-                               List<Token> list = initTokens;\r
-                               java.util.Collections.sort(list, comparator);\r
-                               initCode = processTokens(initTokens);\r
-\r
-                               //\r
-                               // Generate Structure Declaration for PcdTokens without Default Value\r
-                               // PEI_PCD_DATABASE_UNINIT\r
-                               //\r
-                               java.util.Collections.sort(uninitTokens, comparator);\r
-                               uninitCode = processTokens(uninitTokens);\r
-\r
-                               //\r
-                               // Generate size info Macro for all Tables\r
-                               //\r
-                               macroStr += guidTable.getSizeMacro();\r
-                               macroStr += stringTable.getSizeMacro();\r
-                               macroStr += skuIdTable.getSizeMacro();\r
-                               macroStr += localTokenNumberTable.getSizeMacro();\r
-                               macroStr += exMapTable.getSizeMacro();\r
-\r
-                               //\r
-                               // Generate existance info Macro for all Tables\r
-                               //\r
-                         macroStr += guidTable.getExistanceMacro();\r
-                               macroStr += stringTable.getExistanceMacro();\r
-                               macroStr += skuIdTable.getExistanceMacro();\r
-                               macroStr += localTokenNumberTable.getExistanceMacro();\r
-                               macroStr += exMapTable.getExistanceMacro();\r
-\r
-                               //\r
-                               // Generate Structure Declaration for PcdTokens with Default Value\r
-                               // for example PEI_PCD_DATABASE_INIT\r
-                               //\r
-                               initDeclStr += "typedef struct {" + newLine;\r
-                                               {\r
-                                                               initDeclStr += tab + exMapTable.getTypeDeclaration();\r
-                                                               initDeclStr += tab + guidTable.getTypeDeclaration();\r
-                                                               initDeclStr += tab + localTokenNumberTable.getTypeDeclaration();\r
-                                                               initDeclStr += tab + stringTable.getTypeDeclaration();\r
-                                                               initDeclStr += tab + sizeTable.getTypeDeclaration();\r
-                                                               initDeclStr += tab + skuIdTable.getTypeDeclaration();\r
-                                                               if (phase.equalsIgnoreCase("PEI")) {\r
-                                                                               initDeclStr += tab + "SKU_ID            SystemSkuId;" + newLine;\r
-                                                               }\r
-\r
-                                                               decla = initCode.get(new String("Declaration"));\r
-                                                               for (i = 0; i < decla.size(); i++)  {\r
-                                                                               initDeclStr += tab + decla.get(i) + declNewLine;\r
-                                                               }\r
-\r
-                                                               //\r
-                                                               // Generate Structure Declaration for PcdToken with SkuEnabled\r
-                                                               //\r
-                                                               decla = initCode.get("DeclarationForSku");\r
-\r
-                                                               for (i = 0; i < decla.size(); i++) {\r
-                                                                               initDeclStr += tab + decla.get(i) + declNewLine;\r
-                                                               }\r
-                                               }\r
-                         initDeclStr += String.format("} %s_PCD_DATABASE_INIT;\r\n\r\n", phase);\r
-\r
-                               //\r
-                               // Generate MACRO for structure intialization of PCDTokens with Default Value\r
-                               // The sequence must match the sequence of declaration of the memembers in the structure\r
-                               String tmp = String.format("%s_PCD_DATABASE_INIT g%sPcdDbInit = { ", phase.toUpperCase(), phase.toUpperCase());\r
-                               initInstStr +=  tmp + newLine;\r
-                               initInstStr += tab + genInstantiationStr(exMapTable.getInstantiation()) + commaNewLine;\r
-                               initInstStr += tab + genInstantiationStr(guidTable.getInstantiation()) + commaNewLine;\r
-                               initInstStr += tab + genInstantiationStr(localTokenNumberTable.getInstantiation()) + commaNewLine; \r
-                               /*\r
-                               inst = stringTable.getInstantiation();\r
-                               for (i = 0; i < inst.size(); i++ ) {\r
-                                               initInstStr += tab + inst.get(i) + commaNewLine; \r
-                               }\r
-                               */\r
-                               initInstStr += tab + genInstantiationStr(stringTable.getInstantiation()) + commaNewLine;\r
-                               initInstStr += tab + genInstantiationStr(sizeTable.getInstantiation()) + commaNewLine;\r
-                               initInstStr += tab + genInstantiationStr(skuIdTable.getInstantiation()) + commaNewLine;\r
-                               //\r
-                               // For SystemSkuId\r
-                               //\r
-                               if (phase.equalsIgnoreCase("PEI")) {\r
-                                               initInstStr += tab + "0" + tab + "/* SystemSkuId */" + commaNewLine;\r
-                               }\r
-\r
-                               inst = initCode.get("Instantiation");\r
-                               for (i = 0; i < inst.size(); i++) {\r
-                                               initInstStr += tab + inst.get(i) + commaNewLine;\r
-                               }\r
-\r
-                               inst = initCode.get("InstantiationForSku");\r
-                               for (i = 0; i < inst.size(); i++) {\r
-                                               initInstStr += tab + inst.get(i);\r
-                                               if (i != inst.size() - 1) {\r
-                                                               initInstStr += commaNewLine;\r
-                                               }\r
-                               }\r
-\r
-                               initInstStr += "};";\r
-\r
-                               uninitDeclStr += "typedef struct {" + newLine;\r
-                                               {\r
-                                                               decla = uninitCode.get("Declaration");\r
-                                                               if (decla.size() == 0) {\r
-                                                                               uninitDeclStr += "UINT8 dummy /* The UINT struct is empty */" + declNewLine;\r
-                                                               } else {\r
-               \r
-                                                                               for (i = 0; i < decla.size(); i++) {\r
-                                                                                               uninitDeclStr += tab + decla.get(i) + declNewLine;\r
-                                                                               }\r
-               \r
-                                                                               decla = uninitCode.get("DeclarationForSku");\r
-               \r
-                                                                               for (i = 0; i < decla.size(); i++) {\r
-                                                                                               uninitDeclStr += tab + decla.get(i) + declNewLine;\r
-                                                                               }\r
-                                                               }\r
-                                               }\r
-                               uninitDeclStr += String.format("} %s_PCD_DATABASE_UNINIT;\r\n\r\n", phase);\r
-\r
-                               cString = initInstStr + newLine;\r
-                               hString = macroStr      + newLine  \r
-                                                 + initDeclStr         + newLine\r
-                                                       + uninitDeclStr + newLine\r
-                                                 + newLine;\r
-\r
-               }\r
-\r
-               private String genInstantiationStr (ArrayList<String> alStr) {\r
-                               String str = "";\r
-                               for (int i = 0; i< alStr.size(); i++) {\r
-                                               str += "\t" + alStr.get(i);\r
-                                               if (i != alStr.size() - 1) {\r
-                                                               str += "\r\n";\r
-                                               }\r
-                               }\r
-\r
-                               return str;\r
-               }\r
-\r
-               private HashMap<String, ArrayList<String>> processTokens (List<Token> alToken) {\r
-\r
-                               ArrayList[]  output = new ArrayList[4];\r
-                               HashMap <String, ArrayList<String>> map = new HashMap<String, ArrayList<String>>();\r
-\r
-                               ArrayList<String> decl = new ArrayList<String>();\r
-                               ArrayList<String> declForSkuEnableType = new ArrayList<String>();\r
-                               ArrayList<String> inst = new ArrayList<String>();\r
-                               ArrayList<String> instForSkuEnableType = new ArrayList<String>();\r
-\r
-                               for (int index = 0; index < alToken.size(); index++) {\r
-                                               Token token = alToken.get(index);\r
-\r
-                                               if (token.skuEnabled) {\r
-                                                               //\r
-                                                               // BugBug: Schema only support Data type now\r
-                                                               //\r
-                                                               int tableIdx;\r
-\r
-                                                               tableIdx = skuIdTable.add(token);\r
-\r
-                                                               decl.add(getSkuEnabledTypeDeclaration(token));\r
-                                                               if (token.hasDefaultValue()) {\r
-                                                                               inst.add(getSkuEnabledTypeInstantiaion(token, tableIdx)); \r
-                                                               }\r
-\r
-                                                               declForSkuEnableType.add(getDataTypeDeclarationForSkuEnabled(token));\r
-                                                               if (token.hasDefaultValue()) {\r
-                                                                               instForSkuEnableType.add(getDataTypeInstantiationForSkuEnabled(token));\r
-                                                               }\r
-\r
-                                               } else {\r
-                                                               if (token.hiiEnabled) {\r
-                                                                               decl.add(getVariableEnableTypeDeclaration(token));\r
-                                                                               inst.add(getVariableEnableInstantiation(token));\r
-                                                               } else if (token.vpdEnabled) {\r
-                                                                               decl.add(getVpdEnableTypeDeclaration(token));\r
-                                                                               inst.add(getVpdEnableTypeInstantiation(token));\r
-                                                               } else if (token.isStringType()) {\r
-                                                                               decl.add(getStringTypeDeclaration(token));\r
-                                                                               inst.add(getStringTypeInstantiation(stringTable.add(token.getStringTypeString(), token), token));\r
-                                                               }\r
-                                                               else {\r
-                                                                               decl.add(getDataTypeDeclaration(token));\r
-                                                                               if (token.hasDefaultValue()) {\r
-                                                                                               inst.add(getDataTypeInstantiation(token));\r
-                                                                               }\r
-                                                               }\r
-                                               }\r
-\r
-                                               sizeTable.add(token);\r
-                                               localTokenNumberTable.add(token);\r
-                                               token.assignedtokenNumber = assignedTokenNumber++;\r
-\r
-                               }\r
-\r
-                               map.put("Declaration",  decl);\r
-                               map.put("DeclarationForSku", declForSkuEnableType);\r
-                               map.put("Instantiation", inst);\r
-                               map.put("InstantiationForSku", instForSkuEnableType);\r
-\r
-                               return map;\r
-               }\r
-\r
-               private String getSkuEnabledTypeDeclaration (Token token) {\r
-                               return String.format("SKU_HEAD %s;\r\n", token.getPrimaryKeyString());\r
-               }\r
-\r
-               private String getSkuEnabledTypeInstantiaion (Token token, int SkuTableIdx) {\r
-\r
-                               String offsetof = String.format(PcdDatabase.offsetOfSkuHeadStrTemplate, phase, token.hasDefaultValue()? "Init" : "Uninit", token.getPrimaryKeyString());\r
-                               return String.format("{ %s, %d }", offsetof, SkuTableIdx);\r
-               }\r
-\r
-               private String getDataTypeDeclarationForSkuEnabled (Token token) {\r
-                               String typeStr = "";\r
-\r
-                               if (token.datumType == Token.DATUM_TYPE.UINT8) {\r
-                                               typeStr = "UINT8 %s_%s[%d];\r\n";\r
-                               } else if (token.datumType == Token.DATUM_TYPE.UINT16) {\r
-                                               typeStr = "UINT16 %s_%s[%d];\r\n";\r
-                               } else if (token.datumType == Token.DATUM_TYPE.UINT32) {\r
-                                               typeStr = "UINT32 %s_%s[%d];\r\n";\r
-                               } else if (token.datumType == Token.DATUM_TYPE.UINT64) {\r
-                                               typeStr = "UINT64 %s_%s[%d];\r\n";\r
-                               } else if (token.datumType == Token.DATUM_TYPE.BOOLEAN) {\r
-                                               typeStr = "BOOLEAN %s_%s[%d];\r\n";\r
-                               } else if (token.datumType == Token.DATUM_TYPE.POINTER) {\r
-                                               return String.format("UINT8 %s_s[%d];\r\n", token.getPrimaryKeyString(), "SkuDataTable", token.datumSize * token.maxSkuCount);\r
-                               \r
-\r
-                               return String.format(typeStr, token.getPrimaryKeyString(), "SkuDataTable", token.maxSkuCount);\r
-\r
-               }\r
-\r
-               private String getDataTypeInstantiationForSkuEnabled (Token token) {\r
-                               String str = "";\r
-\r
-                               if (token.datumType == Token.DATUM_TYPE.POINTER) {\r
-                                               return String.format("UINT8 %s_s[%d]", token.getPrimaryKeyString(), "SkuDataTable", token.datumSize * token.maxSkuCount);\r
-                               } else {\r
-                                               str = "{ ";\r
-                                               for (int idx = 0; idx < token.maxSkuCount; idx++) {\r
-                                                               str += token.skuData.get(idx).toString();\r
-                                                               if (idx != token.maxSkuCount - 1) {\r
-                                                                               str += ", ";\r
-                                                               }\r
-                                               }\r
-                                               str += "}";\r
-\r
-                                               return str;\r
-                               }\r
-\r
-               }\r
-\r
-               private String getDataTypeInstantiation (Token token) {\r
-\r
-                               String typeStr = "";\r
-\r
-                               if (token.datumType == Token.DATUM_TYPE.POINTER) {\r
-                                               return String.format("%s /* %s */", token.datum.toString(), token.getPrimaryKeyString());\r
-                               } else {\r
-                                               return String.format("%s /* %s */", token.datum.toString(), token.getPrimaryKeyString());\r
-                               }\r
-               }\r
-\r
-\r
-               private String getDataTypeDeclaration (Token token) {\r
-\r
-                               String typeStr = "";\r
-\r
-                               if (token.datumType == Token.DATUM_TYPE.UINT8) {\r
-                                               typeStr = "UINT8";\r
-                               } else if (token.datumType == Token.DATUM_TYPE.UINT16) {\r
-                                               typeStr = "UINT16";\r
-                               } else if (token.datumType == Token.DATUM_TYPE.UINT32) {\r
-                                               typeStr = "UINT32";\r
-                               } else if (token.datumType == Token.DATUM_TYPE.UINT64) {\r
-                                               typeStr = "UINT64";\r
-                               } else if (token.datumType == Token.DATUM_TYPE.BOOLEAN) {\r
-                                               typeStr = "BOOLEAN";\r
-                               } else if (token.datumType == Token.DATUM_TYPE.POINTER) {\r
-                                               return String.format("UINT8 %s[%d]", token.getPrimaryKeyString(), token.datumSize);\r
-                               } else {\r
-                               }\r
-\r
-                               return String.format("%s                %s", typeStr, token.getPrimaryKeyString());\r
-               }\r
-\r
-               private String getVpdEnableTypeDeclaration (Token token) {\r
-                               return String.format("VPD_HEAD %s", token.getPrimaryKeyString());\r
-               }\r
-\r
-               private String getVpdEnableTypeInstantiation (Token token) {\r
-                               return String.format("{ %d } /* %s */", token.vpdOffset,\r
-                                                                                                                                                                                               token.getPrimaryKeyString());\r
-               }\r
-\r
-               private String getStringTypeDeclaration (Token token) {\r
-                               return String.format("UINT16    %s", token.getPrimaryKeyString());\r
-               }\r
-\r
-               private String getStringTypeInstantiation (int StringTableIdx, Token token) {\r
-                               return String.format ("%d /* %s */", StringTableIdx,\r
-                                                                                                                                                                                token.getPrimaryKeyString()); \r
-               }\r
-\r
-\r
-               private String getVariableEnableTypeDeclaration (Token token) {\r
-                       return String.format("VARIABLE_HEAD  %s", token.getPrimaryKeyString());\r
-               }\r
-\r
-               private String getVariableEnableInstantiation (Token token) {\r
-                               return String.format("{ %d, %d, %d } /* %s */", guidTable.add(token.variableGuid, token.getPrimaryKeyString()),\r
-                                                                                                                                                                                                                               stringTable.add(token.variableName, token),\r
-                                                                                                                                                                                                                               token.variableOffset, \r
-                                                                                                                                                                                                                               token.getPrimaryKeyString());\r
-               }\r
-\r
-               public int getTotalTokenNumber () {\r
-                               return sizeTable.getTableLen();\r
-               }\r
+        final String newLine                        = "\r\n";\r
+        final String instNewLine                    = "\\\r\n";\r
+        final String declNewLine                    = ";\r\n";\r
+        final String tab                            = "\t";\r
+        final String commaInstNewLine                   = "\t,\\\r\n";\r
+        final String commaNewLine                   = ", \r\n";\r
+\r
+        int i;\r
+        ArrayList<String> decla;\r
+        ArrayList<String> inst;\r
+\r
+        String macroStr   = "";\r
+        String initDeclStr = "";\r
+        String initInstStr = "";\r
+        String uninitDeclStr = "";\r
+\r
+        List<Token> initTokens = new ArrayList<Token> ();\r
+        List<Token> uninitTokens = new ArrayList<Token> ();\r
+        \r
+        HashMap <String, ArrayList<String>> initCode = new HashMap<String, ArrayList<String>> ();\r
+        HashMap <String, ArrayList<String>> uninitCode = new HashMap<String, ArrayList<String>> ();\r
+\r
+        getTwoGroupsOfTokens (alTokens, initTokens, uninitTokens);\r
+\r
+        //\r
+        // Generate Structure Declaration for PcdTokens without Default Value\r
+        // PEI_PCD_DATABASE_INIT\r
+        //\r
+        java.util.Comparator comparator = new AlignmentSizeComp();\r
+        List<Token> list = initTokens;\r
+        java.util.Collections.sort(list, comparator);\r
+        initCode = processTokens(initTokens);\r
+\r
+        //\r
+        // Generate Structure Declaration for PcdTokens without Default Value\r
+        // PEI_PCD_DATABASE_UNINIT\r
+        //\r
+        java.util.Collections.sort(uninitTokens, comparator);\r
+        uninitCode = processTokens(uninitTokens);\r
+\r
+        //\r
+        // Generate size info Macro for all Tables\r
+        //\r
+        macroStr += guidTable.getSizeMacro();\r
+        macroStr += stringTable.getSizeMacro();\r
+        macroStr += skuIdTable.getSizeMacro();\r
+        macroStr += localTokenNumberTable.getSizeMacro();\r
+        macroStr += exMapTable.getSizeMacro();\r
+\r
+        //\r
+        // Generate existance info Macro for all Tables\r
+        //\r
+        macroStr += guidTable.getExistanceMacro();\r
+        macroStr += stringTable.getExistanceMacro();\r
+        macroStr += skuIdTable.getExistanceMacro();\r
+        macroStr += localTokenNumberTable.getExistanceMacro();\r
+        macroStr += exMapTable.getExistanceMacro();\r
+\r
+        //\r
+        // Generate Structure Declaration for PcdTokens with Default Value\r
+        // for example PEI_PCD_DATABASE_INIT\r
+        //\r
+        initDeclStr += "typedef struct {" + newLine;\r
+            {\r
+                initDeclStr += tab + exMapTable.getTypeDeclaration();\r
+                initDeclStr += tab + guidTable.getTypeDeclaration();\r
+                initDeclStr += tab + localTokenNumberTable.getTypeDeclaration();\r
+                initDeclStr += tab + stringTable.getTypeDeclaration();\r
+                initDeclStr += tab + sizeTable.getTypeDeclaration();\r
+                initDeclStr += tab + skuIdTable.getTypeDeclaration();\r
+                if (phase.equalsIgnoreCase("PEI")) {\r
+                    initDeclStr += tab + "SKU_ID            SystemSkuId;" + newLine;\r
+                }\r
+\r
+                decla = initCode.get(new String("Declaration"));\r
+                for (i = 0; i < decla.size(); i++)  {\r
+                    initDeclStr += tab + decla.get(i) + declNewLine;\r
+                }\r
+\r
+                //\r
+                // Generate Structure Declaration for PcdToken with SkuEnabled\r
+                //\r
+                decla = initCode.get("DeclarationForSku");\r
+\r
+                for (i = 0; i < decla.size(); i++) {\r
+                    initDeclStr += tab + decla.get(i) + declNewLine;\r
+                }\r
+            }\r
+        initDeclStr += String.format("} %s_PCD_DATABASE_INIT;\r\n\r\n", phase);\r
+\r
+        //\r
+        // Generate MACRO for structure intialization of PCDTokens with Default Value\r
+        // The sequence must match the sequence of declaration of the memembers in the structure\r
+        String tmp = String.format("%s_PCD_DATABASE_INIT g%sPcdDbInit = { ", phase.toUpperCase(), phase.toUpperCase());\r
+        initInstStr +=  tmp + newLine;\r
+        initInstStr += tab + genInstantiationStr(exMapTable.getInstantiation()) + commaNewLine;\r
+        initInstStr += tab + genInstantiationStr(guidTable.getInstantiation()) + commaNewLine;\r
+        initInstStr += tab + genInstantiationStr(localTokenNumberTable.getInstantiation()) + commaNewLine; \r
+        /*\r
+        inst = stringTable.getInstantiation();\r
+        for (i = 0; i < inst.size(); i++ ) {\r
+            initInstStr += tab + inst.get(i) + commaNewLine; \r
+        }\r
+        */\r
+        initInstStr += tab + genInstantiationStr(stringTable.getInstantiation()) + commaNewLine;\r
+        initInstStr += tab + genInstantiationStr(sizeTable.getInstantiation()) + commaNewLine;\r
+        initInstStr += tab + genInstantiationStr(skuIdTable.getInstantiation()) + commaNewLine;\r
+        //\r
+        // For SystemSkuId\r
+        //\r
+        if (phase.equalsIgnoreCase("PEI")) {\r
+            initInstStr += tab + "0" + tab + "/* SystemSkuId */" + commaNewLine;\r
+        }\r
+\r
+        inst = initCode.get("Instantiation");\r
+        for (i = 0; i < inst.size(); i++) {\r
+            initInstStr += tab + inst.get(i) + commaNewLine;\r
+        }\r
+\r
+        inst = initCode.get("InstantiationForSku");\r
+        for (i = 0; i < inst.size(); i++) {\r
+            initInstStr += tab + inst.get(i);\r
+            if (i != inst.size() - 1) {\r
+                initInstStr += commaNewLine;\r
+            }\r
+        }\r
+\r
+        initInstStr += "};";\r
+\r
+        uninitDeclStr += "typedef struct {" + newLine;\r
+            {\r
+                decla = uninitCode.get("Declaration");\r
+                if (decla.size() == 0) {\r
+                    uninitDeclStr += "UINT8 dummy /* The UINT struct is empty */" + declNewLine;\r
+                } else {\r
+    \r
+                    for (i = 0; i < decla.size(); i++) {\r
+                        uninitDeclStr += tab + decla.get(i) + declNewLine;\r
+                    }\r
+    \r
+                    decla = uninitCode.get("DeclarationForSku");\r
+    \r
+                    for (i = 0; i < decla.size(); i++) {\r
+                        uninitDeclStr += tab + decla.get(i) + declNewLine;\r
+                    }\r
+                }\r
+            }\r
+        uninitDeclStr += String.format("} %s_PCD_DATABASE_UNINIT;\r\n\r\n", phase);\r
+\r
+        cString = initInstStr + newLine;\r
+        hString = macroStr      + newLine  \r
+              + initDeclStr   + newLine\r
+              + uninitDeclStr + newLine\r
+              + newLine;\r
+\r
+    }\r
+\r
+    private String genInstantiationStr (ArrayList<String> alStr) {\r
+        String str = "";\r
+        for (int i = 0; i< alStr.size(); i++) {\r
+            str += "\t" + alStr.get(i);\r
+            if (i != alStr.size() - 1) {\r
+                str += "\r\n";\r
+            }\r
+        }\r
+\r
+        return str;\r
+    }\r
+\r
+    private HashMap<String, ArrayList<String>> processTokens (List<Token> alToken) {\r
+\r
+        ArrayList[]  output = new ArrayList[4];\r
+        HashMap <String, ArrayList<String>> map = new HashMap<String, ArrayList<String>>();\r
+\r
+        ArrayList<String> decl = new ArrayList<String>();\r
+        ArrayList<String> declForSkuEnableType = new ArrayList<String>();\r
+        ArrayList<String> inst = new ArrayList<String>();\r
+        ArrayList<String> instForSkuEnableType = new ArrayList<String>();\r
+\r
+        for (int index = 0; index < alToken.size(); index++) {\r
+            Token token = alToken.get(index);\r
+\r
+            if (token.skuEnabled) {\r
+                //\r
+                // BugBug: Schema only support Data type now\r
+                //\r
+                int tableIdx;\r
+\r
+                tableIdx = skuIdTable.add(token);\r
+\r
+                decl.add(getSkuEnabledTypeDeclaration(token));\r
+                if (token.hasDefaultValue()) {\r
+                    inst.add(getSkuEnabledTypeInstantiaion(token, tableIdx)); \r
+                }\r
+\r
+                declForSkuEnableType.add(getDataTypeDeclarationForSkuEnabled(token));\r
+                if (token.hasDefaultValue()) {\r
+                    instForSkuEnableType.add(getDataTypeInstantiationForSkuEnabled(token));\r
+                }\r
+\r
+            } else {\r
+                if (token.hiiEnabled) {\r
+                    decl.add(getVariableEnableTypeDeclaration(token));\r
+                    inst.add(getVariableEnableInstantiation(token));\r
+                } else if (token.vpdEnabled) {\r
+                    decl.add(getVpdEnableTypeDeclaration(token));\r
+                    inst.add(getVpdEnableTypeInstantiation(token));\r
+                } else if (token.isStringType()) {\r
+                    decl.add(getStringTypeDeclaration(token));\r
+                    inst.add(getStringTypeInstantiation(stringTable.add(token.getStringTypeString(), token), token));\r
+                }\r
+                else {\r
+                    decl.add(getDataTypeDeclaration(token));\r
+                    if (token.hasDefaultValue()) {\r
+                        inst.add(getDataTypeInstantiation(token));\r
+                    }\r
+                }\r
+            }\r
+\r
+            sizeTable.add(token);\r
+            localTokenNumberTable.add(token);\r
+            token.assignedtokenNumber = assignedTokenNumber++;\r
+\r
+        }\r
+\r
+        map.put("Declaration",  decl);\r
+        map.put("DeclarationForSku", declForSkuEnableType);\r
+        map.put("Instantiation", inst);\r
+        map.put("InstantiationForSku", instForSkuEnableType);\r
+\r
+        return map;\r
+    }\r
+\r
+    private String getSkuEnabledTypeDeclaration (Token token) {\r
+        return String.format("SKU_HEAD %s;\r\n", token.getPrimaryKeyString());\r
+    }\r
+\r
+    private String getSkuEnabledTypeInstantiaion (Token token, int SkuTableIdx) {\r
+\r
+        String offsetof = String.format(PcdDatabase.offsetOfSkuHeadStrTemplate, phase, token.hasDefaultValue()? "Init" : "Uninit", token.getPrimaryKeyString());\r
+        return String.format("{ %s, %d }", offsetof, SkuTableIdx);\r
+    }\r
+\r
+    private String getDataTypeDeclarationForSkuEnabled (Token token) {\r
+        String typeStr = "";\r
+\r
+        if (token.datumType == Token.DATUM_TYPE.UINT8) {\r
+            typeStr = "UINT8 %s_%s[%d];\r\n";\r
+        } else if (token.datumType == Token.DATUM_TYPE.UINT16) {\r
+            typeStr = "UINT16 %s_%s[%d];\r\n";\r
+        } else if (token.datumType == Token.DATUM_TYPE.UINT32) {\r
+            typeStr = "UINT32 %s_%s[%d];\r\n";\r
+        } else if (token.datumType == Token.DATUM_TYPE.UINT64) {\r
+            typeStr = "UINT64 %s_%s[%d];\r\n";\r
+        } else if (token.datumType == Token.DATUM_TYPE.BOOLEAN) {\r
+            typeStr = "BOOLEAN %s_%s[%d];\r\n";\r
+        } else if (token.datumType == Token.DATUM_TYPE.POINTER) {\r
+            return String.format("UINT8 %s_s[%d];\r\n", token.getPrimaryKeyString(), "SkuDataTable", token.datumSize * token.maxSkuCount);\r
+        } \r
+\r
+        return String.format(typeStr, token.getPrimaryKeyString(), "SkuDataTable", token.maxSkuCount);\r
+\r
+    }\r
+\r
+    private String getDataTypeInstantiationForSkuEnabled (Token token) {\r
+        String str = "";\r
+\r
+        if (token.datumType == Token.DATUM_TYPE.POINTER) {\r
+            return String.format("UINT8 %s_s[%d]", token.getPrimaryKeyString(), "SkuDataTable", token.datumSize * token.maxSkuCount);\r
+        } else {\r
+            str = "{ ";\r
+            for (int idx = 0; idx < token.maxSkuCount; idx++) {\r
+                str += token.skuData.get(idx).toString();\r
+                if (idx != token.maxSkuCount - 1) {\r
+                    str += ", ";\r
+                }\r
+            }\r
+            str += "}";\r
+\r
+            return str;\r
+        }\r
+\r
+    }\r
+\r
+    private String getDataTypeInstantiation (Token token) {\r
+\r
+        String typeStr = "";\r
+\r
+        if (token.datumType == Token.DATUM_TYPE.POINTER) {\r
+            return String.format("%s /* %s */", token.datum.toString(), token.getPrimaryKeyString());\r
+        } else {\r
+            return String.format("%s /* %s */", token.datum.toString(), token.getPrimaryKeyString());\r
+        }\r
+    }\r
+\r
+\r
+    private String getDataTypeDeclaration (Token token) {\r
+\r
+        String typeStr = "";\r
+\r
+        if (token.datumType == Token.DATUM_TYPE.UINT8) {\r
+            typeStr = "UINT8";\r
+        } else if (token.datumType == Token.DATUM_TYPE.UINT16) {\r
+            typeStr = "UINT16";\r
+        } else if (token.datumType == Token.DATUM_TYPE.UINT32) {\r
+            typeStr = "UINT32";\r
+        } else if (token.datumType == Token.DATUM_TYPE.UINT64) {\r
+            typeStr = "UINT64";\r
+        } else if (token.datumType == Token.DATUM_TYPE.BOOLEAN) {\r
+            typeStr = "BOOLEAN";\r
+        } else if (token.datumType == Token.DATUM_TYPE.POINTER) {\r
+            return String.format("UINT8 %s[%d]", token.getPrimaryKeyString(), token.datumSize);\r
+        } else {\r
+        }\r
+\r
+        return String.format("%s    %s", typeStr, token.getPrimaryKeyString());\r
+    }\r
+\r
+    private String getVpdEnableTypeDeclaration (Token token) {\r
+        return String.format("VPD_HEAD %s", token.getPrimaryKeyString());\r
+    }\r
+\r
+    private String getVpdEnableTypeInstantiation (Token token) {\r
+        return String.format("{ %d } /* %s */", token.vpdOffset,\r
+                                                token.getPrimaryKeyString());\r
+    }\r
+\r
+    private String getStringTypeDeclaration (Token token) {\r
+        return String.format("UINT16  %s", token.getPrimaryKeyString());\r
+    }\r
+\r
+    private String getStringTypeInstantiation (int StringTableIdx, Token token) {\r
+        return String.format ("%d /* %s */", StringTableIdx,\r
+                                             token.getPrimaryKeyString()); \r
+    }\r
+\r
+\r
+    private String getVariableEnableTypeDeclaration (Token token) {\r
+      return String.format("VARIABLE_HEAD  %s", token.getPrimaryKeyString());\r
+    }\r
+\r
+    private String getVariableEnableInstantiation (Token token) {\r
+        return String.format("{ %d, %d, %d } /* %s */", guidTable.add(token.variableGuid, token.getPrimaryKeyString()),\r
+                                                        stringTable.add(token.variableName, token),\r
+                                                        token.variableOffset, \r
+                                                        token.getPrimaryKeyString());\r
+    }\r
+\r
+    public int getTotalTokenNumber () {\r
+        return sizeTable.getTableLen();\r
+    }\r
 \r
     public static String getPcdDatabaseCommonDefinitions () \r
         throws EntityException {\r
 \r
         String retStr = "";\r
         try {\r
-                                               File file = new File(GlobalData.getWorkspacePath() + File.separator + \r
-                                                                                                                                "Tools" + File.separator + \r
-                                                                                                                                "Conf" + File.separator +\r
-                                                                                                                                "Pcd" + File.separator +\r
-                                                                                                                                "PcdDatabaseCommonDefinitions.sample");\r
-                                               System.out.println(GlobalData.getWorkspacePath());\r
+            File file = new File(GlobalData.getWorkspacePath() + File.separator + \r
+                                 "Tools" + File.separator + \r
+                                 "Conf" + File.separator +\r
+                                 "Pcd" + File.separator +\r
+                                 "PcdDatabaseCommonDefinitions.sample");\r
+            System.out.println(GlobalData.getWorkspacePath());\r
             FileReader reader = new FileReader(file);\r
             BufferedReader  in = new BufferedReader(reader);\r
             String str;\r
@@ -1129,51 +1129,51 @@ class PcdDatabase {
         return retStr;\r
     }\r
 \r
-               public static String getPcdDxeDatabaseDefinitions () \r
-                               throws EntityException {\r
-\r
-                               String retStr = "";\r
-                               try {\r
-                                               File file = new File(GlobalData.getWorkspacePath() + File.separator + \r
-                                                                                                                                "Tools" + File.separator + \r
-                                                                                                                                "Conf" + File.separator +\r
-                                                                                                                                "Pcd" + File.separator +\r
-                                                                                                                                "PcdDatabaseDxeDefinitions.sample");\r
-                                               FileReader reader = new FileReader(file);\r
-                                               BufferedReader  in = new BufferedReader(reader);\r
-                                               String str;\r
-                                               while ((str = in.readLine()) != null) {\r
-                                                               retStr = retStr +"\r\n" + str;\r
-                                               }\r
-                               } catch (Exception ex) {\r
-                                               throw new EntityException("Fatal error when generating PcdDatabase Dxe Definitions");\r
-                               }\r
-\r
-                               return retStr;\r
-               }\r
-\r
-               public static String getPcdPeiDatabaseDefinitions () \r
-                               throws EntityException {\r
-\r
-                               String retStr = "";\r
-                               try {\r
-                                               File file = new File(GlobalData.getWorkspacePath() + File.separator + \r
-                                                                                                                                "Tools" + File.separator + \r
-                                                                                                                                "Conf" + File.separator +\r
-                                                                                                                                "Pcd" + File.separator +\r
-                                                                                                                                "PcdDatabasePeiDefinitions.sample");\r
-                                               FileReader reader = new FileReader(file);\r
-                                               BufferedReader  in = new BufferedReader(reader);\r
-                                               String str;\r
-                                               while ((str = in.readLine()) != null) {\r
-                                                               retStr = retStr +"\r\n" + str;\r
-                                               }\r
-                               } catch (Exception ex) {\r
-                                               throw new EntityException("Fatal error when generating PcdDatabase Pei Definitions");\r
-                               }\r
-\r
-                               return retStr;\r
-               }\r
+    public static String getPcdDxeDatabaseDefinitions () \r
+        throws EntityException {\r
+\r
+        String retStr = "";\r
+        try {\r
+            File file = new File(GlobalData.getWorkspacePath() + File.separator + \r
+                                 "Tools" + File.separator + \r
+                                 "Conf" + File.separator +\r
+                                 "Pcd" + File.separator +\r
+                                 "PcdDatabaseDxeDefinitions.sample");\r
+            FileReader reader = new FileReader(file);\r
+            BufferedReader  in = new BufferedReader(reader);\r
+            String str;\r
+            while ((str = in.readLine()) != null) {\r
+                retStr = retStr +"\r\n" + str;\r
+            }\r
+        } catch (Exception ex) {\r
+            throw new EntityException("Fatal error when generating PcdDatabase Dxe Definitions");\r
+        }\r
+\r
+        return retStr;\r
+    }\r
+\r
+    public static String getPcdPeiDatabaseDefinitions () \r
+        throws EntityException {\r
+\r
+        String retStr = "";\r
+        try {\r
+            File file = new File(GlobalData.getWorkspacePath() + File.separator + \r
+                                 "Tools" + File.separator + \r
+                                 "Conf" + File.separator +\r
+                                 "Pcd" + File.separator +\r
+                                 "PcdDatabasePeiDefinitions.sample");\r
+            FileReader reader = new FileReader(file);\r
+            BufferedReader  in = new BufferedReader(reader);\r
+            String str;\r
+            while ((str = in.readLine()) != null) {\r
+                retStr = retStr +"\r\n" + str;\r
+            }\r
+        } catch (Exception ex) {\r
+            throw new EntityException("Fatal error when generating PcdDatabase Pei Definitions");\r
+        }\r
+\r
+        return retStr;\r
+    }\r
 \r
 }\r
 \r
@@ -1350,44 +1350,44 @@ public class CollectPCDAction {
         //\r
         // Call Private function genPcdDatabaseSourceCode (void); ComponentTypeBsDriver\r
         // 1) Generate for PEI, DXE PCD DATABASE's definition and initialization.\r
-                               //\r
-                               genPcdDatabaseSourceCode ();\r
-                               \r
+        //\r
+        genPcdDatabaseSourceCode ();\r
+        \r
     }\r
 \r
-               /**\r
-                       This function generates source code for PCD Database.\r
-                \r
-                       @param void\r
-                       @throws EntityException  If the token does *not* exist in memory database.\r
+    /**\r
+      This function generates source code for PCD Database.\r
+     \r
+      @param void\r
+      @throws EntityException  If the token does *not* exist in memory database.\r
 \r
-               **/\r
+    **/\r
 \r
-    private void genPcdDatabaseSourceCode                      ()\r
-                       throws EntityException {\r
-                               String PcdCommonHeaderString = PcdDatabase.getPcdDatabaseCommonDefinitions ();\r
+    private void genPcdDatabaseSourceCode     ()\r
+      throws EntityException {\r
+        String PcdCommonHeaderString = PcdDatabase.getPcdDatabaseCommonDefinitions ();\r
 \r
-                               ArrayList<Token> alPei = new ArrayList<Token> ();\r
-                               ArrayList<Token> alDxe = new ArrayList<Token> ();\r
+        ArrayList<Token> alPei = new ArrayList<Token> ();\r
+        ArrayList<Token> alDxe = new ArrayList<Token> ();\r
 \r
-                               dbManager.getTwoPhaseDynamicRecordArray(alPei, alDxe);\r
+        dbManager.getTwoPhaseDynamicRecordArray(alPei, alDxe);\r
         PcdDatabase pcdPeiDatabase = new PcdDatabase (alPei, "PEI", 0);\r
-                               pcdPeiDatabase.genCode();\r
-                               dbManager.PcdPeimHString        = PcdCommonHeaderString + pcdPeiDatabase.getHString()\r
-                                                                                                                                                                               + PcdDatabase.getPcdPeiDatabaseDefinitions();\r
-                               dbManager.PcdPeimCString                                = pcdPeiDatabase.getCString();\r
+        pcdPeiDatabase.genCode();\r
+        dbManager.PcdPeimHString        = PcdCommonHeaderString + pcdPeiDatabase.getHString()\r
+                                            + PcdDatabase.getPcdPeiDatabaseDefinitions();\r
+        dbManager.PcdPeimCString        = pcdPeiDatabase.getCString();\r
 \r
         PcdDatabase pcdDxeDatabase = new PcdDatabase (alDxe, \r
-                                                                                                                                                                                                                       "DXE",\r
-                                                                                                                                                                                                                       alPei.size()\r
-                                                                                                                                                                                                                       );\r
-                               pcdDxeDatabase.genCode();\r
-                               dbManager.PcdDxeHString   = dbManager.PcdPeimHString + pcdDxeDatabase.getHString()\r
-                                                                                                                                                       + PcdDatabase.getPcdDxeDatabaseDefinitions();\r
-                               dbManager.PcdDxeCString         = pcdDxeDatabase.getCString();\r
-               }\r
-\r
-               /**\r
+                                                      "DXE",\r
+                                                      alPei.size()\r
+                                                      );\r
+        pcdDxeDatabase.genCode();\r
+        dbManager.PcdDxeHString   = dbManager.PcdPeimHString + pcdDxeDatabase.getHString()\r
+                                      + PcdDatabase.getPcdDxeDatabaseDefinitions();\r
+        dbManager.PcdDxeCString   = pcdDxeDatabase.getCString();\r
+    }\r
+\r
+    /**\r
       This function will collect inherit PCD information from library for a module.\r
      \r
       This function will create two usage instance for inherited PCD token, one is \r
@@ -1679,7 +1679,7 @@ public class CollectPCDAction {
             token.assignedtokenNumber  = Integer.decode(pcdBuildData.getToken().getStringValue());\r
             skuDataArray               = pcdBuildData.getSkuDataArray1();\r
             token.datumType    = Token.getdatumTypeFromString(pcdBuildData.getDatumType().toString());\r
-                                               token.datumSize    = pcdBuildData.getDatumSize();\r
+            token.datumSize    = pcdBuildData.getDatumSize();\r
 \r
             if(skuDataArray != null) {\r
                 for(skuIndex = 0; skuIndex < skuDataArray.size(); skuIndex ++) {\r
index 3d1f1ba..bbf5411 100644 (file)
@@ -190,13 +190,13 @@ public class PCDAutoGenAction extends BuildAction {
             }\r
         }\r
 \r
-                               if (moduleName.equalsIgnoreCase("PcdPeim")) {\r
-                                               hAutoGenString += dbManager.PcdPeimHString;\r
-                                               cAutoGenString += dbManager.PcdPeimCString;\r
-                               } else if (moduleName.equalsIgnoreCase("PcdDxe")) {\r
-                                               hAutoGenString += dbManager.PcdDxeHString;\r
-                                               cAutoGenString += dbManager.PcdDxeCString;\r
-                               }\r
+        if (moduleName.equalsIgnoreCase("PcdPeim")) {\r
+            hAutoGenString += dbManager.PcdPeimHString;\r
+            cAutoGenString += dbManager.PcdPeimCString;\r
+        } else if (moduleName.equalsIgnoreCase("PcdDxe")) {\r
+            hAutoGenString += dbManager.PcdDxeHString;\r
+            cAutoGenString += dbManager.PcdDxeCString;\r
+        }\r
 \r
         ActionMessage.debug(this,\r
                             "Module " + moduleName + "'s PCD header file:\r\n" + hAutoGenString + "\r\n"\r
@@ -527,7 +527,7 @@ public class PCDAutoGenAction extends BuildAction {
     **/\r
     public static void main(String argv[]) {\r
 \r
-                               String WorkSpace = "G:/edk2";\r
+        String WorkSpace = "G:/edk2";\r
         String logFilePath = WorkSpace  + "/EdkNt32Pkg/Nt32.fpd";\r
 \r
         //\r
@@ -552,13 +552,13 @@ public class PCDAutoGenAction extends BuildAction {
         // Then execute the PCDAuotoGenAction to get generated Autogen.h and Autogen.c\r
         //\r
         PCDAutoGenAction autogenAction = new PCDAutoGenAction("PcdDxe",\r
-                                                                                                                                                                                                                                                       false\r
+                                                              false\r
                                                               );\r
-                               autogenAction.execute();\r
+        autogenAction.execute();\r
 \r
-                               System.out.println(autogenAction.OutputH());\r
-                               System.out.println("WQWQWQWQWQ");\r
-                               System.out.println(autogenAction.OutputC());\r
+        System.out.println(autogenAction.OutputH());\r
+        System.out.println("WQWQWQWQWQ");\r
+        System.out.println(autogenAction.OutputC());\r
 \r
 \r
         System.out.println (autogenAction.hAutoGenString);\r
index 7b22b27..7df9639 100644 (file)
@@ -44,9 +44,9 @@ public class MemoryDatabaseManager {
     private static String              logFileName    = null;\r
 \r
     public static String PcdPeimHString       = "";\r
-               public static String PcdPeimCString                             = "";\r
-    public static String PcdDxeHString                         = "";\r
-    public static String PcdDxeCString                         = "";\r
+    public static String PcdPeimCString       = "";\r
+    public static String PcdDxeHString        = "";\r
+    public static String PcdDxeCString        = "";\r
 \r
     /**\r
       Constructure function\r
@@ -174,8 +174,8 @@ public class MemoryDatabaseManager {
         List<UsageInstance>     usageInstanceArray  =   null;\r
         UsageInstance           usageInstance       =   null;\r
 \r
-                               //pei = new ArrayList<Token>();\r
-                               //dxe = new ArrayList<Token>();\r
+        //pei = new ArrayList<Token>();\r
+        //dxe = new ArrayList<Token>();\r
 \r
         for (index = 0; index < tokenArrayList.size(); index++) {\r
             boolean found   =   false;\r
@@ -199,25 +199,25 @@ public class MemoryDatabaseManager {
                         usageInstance =(UsageInstance) usageInstanceArray.get(usageInstanceIndex);\r
                         if (CommonDefinition.isPeiPhaseComponent(usageInstance.componentType)) {\r
                             pei.add(token);\r
-                                                                                                               found = true;\r
+                            found = true;\r
                             break;\r
                         }\r
                     }\r
                 }\r
             }\r
 \r
-                                               //\r
-                                               // If no PEI components reference the PCD entry, we insert it to DXE list\r
-                                               //\r
-                                               if (!found) {\r
-                                                               dxe.add(token);\r
-                                               }\r
+            //\r
+            // If no PEI components reference the PCD entry, we insert it to DXE list\r
+            //\r
+            if (!found) {\r
+                dxe.add(token);\r
+            }\r
         }\r
 \r
-                               return;\r
+        return;\r
     }\r
 \r
-               /**\r
+    /**\r
       Get all PCD record for a module according to module's name.\r
      \r
       @param moduleName  the name of module.\r
index b40e244..5931b8b 100644 (file)
@@ -258,9 +258,9 @@ public class Token {
         }\r
     }\r
 \r
-               public String getPrimaryKeyString () {\r
-                               return cName + "_" + tokenSpaceName.toString().replace('-', '_');\r
-               }\r
+    public String getPrimaryKeyString () {\r
+        return cName + "_" + tokenSpaceName.toString().replace('-', '_');\r
+    }\r
 \r
     /**\r
       Judge datumType is valid\r
@@ -645,13 +645,13 @@ public class Token {
     //\r
     public boolean hasDefaultValue () {\r
 \r
-                               if (hiiEnabled) {\r
-                                               return true;\r
-                               }\r
+        if (hiiEnabled) {\r
+            return true;\r
+        }\r
 \r
-                               if (vpdEnabled) {\r
-                                               return true;\r
-                               }\r
+        if (vpdEnabled) {\r
+            return true;\r
+        }\r
 \r
         if (datum.toString().compareTo("NoDefault") == 0) {\r
             return false;\r
@@ -660,21 +660,21 @@ public class Token {
         return true;\r
     }\r
 \r
-               public boolean isStringType () {\r
-                               String str = datum.toString();\r
+    public boolean isStringType () {\r
+        String str = datum.toString();\r
 \r
-                               if (datumType == Token.DATUM_TYPE.POINTER &&\r
-                                               str.startsWith("L\"") && \r
-                                               str.endsWith("\"")) {\r
-                                               return true;\r
-                               }\r
+        if (datumType == Token.DATUM_TYPE.POINTER &&\r
+            str.startsWith("L\"") && \r
+            str.endsWith("\"")) {\r
+            return true;\r
+        }\r
 \r
-                               return false;\r
-               }\r
+        return false;\r
+    }\r
 \r
-               public String getStringTypeString () {                       \r
-                               return datum.toString().substring(2, datum.toString().length() - 1);\r
-               }\r
+    public String getStringTypeString () {                       \r
+        return datum.toString().substring(2, datum.toString().length() - 1);\r
+    }\r
 }\r
 \r
 \r