git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@412 7335b...
[people/mcb30/basetools.git] / Source / Python / Common / DscClassObject.py
index d0364a4..674a2f8 100644 (file)
@@ -17,6 +17,7 @@ from DataType import *
 from Identification import *\r
 from Dictionary import *\r
 from CommonDataClass.PlatformClass import *\r
+from CommonDataClass.CommonClass import SkuInfoClass\r
 from BuildToolError import *\r
 \r
 class DscObject(object):\r
@@ -63,7 +64,7 @@ class DscContents(DscObject):
 \r
 class Dsc(DscObject):\r
     def __init__(self, filename = None, isMergeAllArches = False, isToPlatform = False):\r
-        self.identification = Identification()\r
+        self.Identification = Identification()\r
         self.Defines = DscDefines()\r
         self.Contents = {}\r
         self.UserExtensions = ''\r
@@ -77,7 +78,7 @@ class Dsc(DscObject):
             TAB_PCDS_PATCHABLE_IN_MODULE_NULL, TAB_PCDS_FEATURE_FLAG_NULL, \\r
             TAB_PCDS_DYNAMIC_DEFAULT_NULL, TAB_PCDS_DYNAMIC_HII_NULL, TAB_PCDS_DYNAMIC_VPD_NULL, \\r
             TAB_PCDS_DYNAMIC_EX_DEFAULT_NULL, TAB_PCDS_DYNAMIC_EX_HII_NULL, TAB_PCDS_DYNAMIC_EX_VPD_NULL, \\r
-            TAB_COMPONENTS, TAB_BUILD_OPTIONS\r
+            TAB_COMPONENTS\r
         ]\r
         \r
         if filename != None:\r
@@ -106,10 +107,14 @@ class Dsc(DscObject):
                 Command = "self.Contents[arch]." + key + ".extend(" + "self.Contents['" + DataType.TAB_ARCH_COMMON + "']." + key + ")"\r
                 eval(Command)\r
             \r
-    def LoadDscFile(self, filename):\r
-        EdkLogger.verbose('Open Dsc File:' + filename)\r
-        f = open(filename, 'r').read()\r
-        sects = f.split('[')\r
+    def LoadDscFile(self, Filename):\r
+        (Filepath, Name) = os.path.split(Filename)\r
+        self.Identification.FileName = Name\r
+        self.Identification.FileFullPath = Filename\r
+        self.Identification.FileRelativePath = Filepath\r
+        \r
+        F = open(Filename, 'r').read()\r
+        sects = F.split('[')\r
         for sect in sects:\r
             tab = (sect.split(TAB_SECTION_END, 1)[0]).upper()\r
             if tab == TAB_INF_DEFINES.upper():\r
@@ -135,15 +140,303 @@ class Dsc(DscObject):
         #\r
         # Get value for Header\r
         #\r
-        self.Module.Header.Name = self.Defines.DefinesDictionary[TAB_DSC_DEFINES_PLATFORM_NAME][0]\r
-        self.Module.Header.Guid = self.Defines.DefinesDictionary[TAB_DSC_DEFINES_PLATFORM_GUID][0]\r
-        self.Module.Header.Version = self.Defines.DefinesDictionary[TAB_DSC_DEFINES_PLATFORM_VERSION][0]\r
-        self.Module.Header.FileName = self.Identification.FileName\r
-        self.Module.Header.FullPath = self.Identification.FileFullPath\r
-        self.Module.Header.InfVersion = self.Defines.DefinesDictionary[TAB_DSC_DEFINES_DSC_SPECIFICATION][0]\r
+        self.Platform.Header.Name = self.Defines.DefinesDictionary[TAB_DSC_DEFINES_PLATFORM_NAME][0]\r
+        self.Platform.Header.Guid = self.Defines.DefinesDictionary[TAB_DSC_DEFINES_PLATFORM_GUID][0]\r
+        self.Platform.Header.Version = self.Defines.DefinesDictionary[TAB_DSC_DEFINES_PLATFORM_VERSION][0]\r
+        self.Platform.Header.FileName = self.Identification.FileName\r
+        self.Platform.Header.FullPath = self.Identification.FileFullPath\r
+        self.Platform.Header.DscSpecification = self.Defines.DefinesDictionary[TAB_DSC_DEFINES_DSC_SPECIFICATION][0]\r
+        \r
+        self.Platform.Header.SkuIdName = self.Defines.DefinesDictionary[TAB_DSC_DEFINES_SKUID_IDENTIFIER]\r
+        self.Platform.Header.SupArchList = self.Defines.DefinesDictionary[TAB_DSC_DEFINES_SUPPORTED_ARCHITECTURES]\r
+        self.Platform.Header.BuildTargets = self.Defines.DefinesDictionary[TAB_DSC_DEFINES_BUILD_TARGETS]\r
+        self.Platform.Header.OutputDirectory = self.Defines.DefinesDictionary[TAB_DSC_DEFINES_OUTPUT_DIRECTORY][0]\r
+        self.Platform.Header.BuildNumber = self.Defines.DefinesDictionary[TAB_DSC_DEFINES_BUILD_NUMBER][0]\r
+        self.Platform.Header.MakefileName = self.Defines.DefinesDictionary[TAB_DSC_DEFINES_MAKEFILE_NAME][0]\r
+        \r
+        Fdf = PlatformFlashDefinitionFileClass()\r
+        Fdf.FilePath = self.Defines.DefinesDictionary[TAB_DSC_DEFINES_FLASH_DEFINITION][0]\r
+        self.Platform.FlashDefinitionFile = Fdf\r
+        \r
+        #BuildOptions\r
+        BuildOptions = {}\r
+        IncludeFiles = {}\r
+        for Arch in DataType.ARCH_LIST:\r
+            for Item in self.Contents[Arch].BuildOptions:\r
+                if GenInclude(Item, IncludeFiles, Arch):\r
+                    continue\r
+                MergeArches(BuildOptions, GetBuildOption(Item), Arch)\r
+        self.Platform.BuildOptions.IncludeFiles = IncludeFiles\r
+        for Key in BuildOptions.keys():\r
+            BuildOption = BuildOptionClass(Key[0], Key[1], Key[2])\r
+            BuildOption.SupArchList = BuildOptions[Key]\r
+            self.Platform.BuildOptions.BuildOptionList.append(BuildOption)\r
+        \r
+        #SkuIds\r
+        IncludeFiles = {}\r
+        self.Platform.SkuInfos.SkuInfoList['DEFAULT'] = '0'\r
+        for Arch in DataType.ARCH_LIST:\r
+            for Item in self.Contents[Arch].SkuIds:\r
+                if GenInclude(Item, IncludeFiles, Arch):\r
+                    continue\r
+                List = GetSplitValueList(Item)\r
+                if len(List) != 2:\r
+                    ErrorMsg = "Wrong statement '%s' found in section SkuIds in file '%s', correct format is '<Integer>|<UiName>'" % (Item, self.Platform.Header.FullPath)\r
+                    raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
+                else:\r
+                    self.Platform.SkuInfos.SkuInfoList[List[1]] = List[0]\r
+        self.Platform.SkuInfos.IncludeFiles = IncludeFiles\r
+        \r
+        #Libraries\r
+        Libraries = {}\r
+        IncludeFiles = {}\r
+        Defines = {}\r
+        for Arch in DataType.ARCH_LIST:\r
+            for Item in self.Contents[Arch].Libraries:\r
+                if GenInclude(Item, IncludeFiles, Arch):\r
+                    continue\r
+                Status = GenDefines(Item, Arch, Defines)\r
+                if Status == 0:       # Find DEFINE statement\r
+                    pass\r
+                elif Status == -1:    # Find DEFINE statement but in wrong format\r
+                    ErrorMsg = "Wrong DEFINE statement '%s' found in section Libraries in file '%s', correct format is 'DEFINE <VarName> = <PATH>'" % (Item, self.Platform.Header.FullPath) \r
+                    raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
+                elif Status == 1:     # Not find DEFINE statement\r
+                    MergeArches(Libraries, Item, Arch)\r
+        self.Platform.Libraries.IncludeFiles = IncludeFiles\r
+        for Key in Libraries.keys():\r
+            Library = PlatformLibraryClass()\r
+            Library.FilePath = Key\r
+            Library.Define = Defines\r
+            Library.SupArchList = Libraries[Key]\r
+            self.Platform.Libraries.LibraryList.append(Library)\r
+        \r
+        #LibraryClasses\r
+        LibraryClasses = {}\r
+        IncludeFiles = {}\r
+        Defines = {}\r
+        for Arch in DataType.ARCH_LIST:\r
+            for Item in self.Contents[Arch].LibraryClasses:\r
+                if GenInclude(Item[0], IncludeFiles, Arch):\r
+                    continue\r
+                Status = GenDefines(Item[0], Arch, Defines)\r
+                if Status == 0:       # Find DEFINE statement\r
+                    pass\r
+                elif Status == -1:    # Find DEFINE statement but in wrong format\r
+                    ErrorMsg = "Wrong DEFINE statement '%s' found in section LibraryClasses in file '%s', correct format is 'DEFINE <VarName> = <PATH>'" % (Item, self.Platform.Header.FullPath) \r
+                    raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
+                elif Status == 1:     # Not find DEFINE statement\r
+                    List = GetSplitValueList(Item[0])\r
+                    if len(List) != 2:\r
+                        ErrorMsg = "Wrong statement '%s' found in section LibraryClasses in file '%s', correct format is '<LibraryClassKeyWord>|<LibraryInstance>'" % (Item, self.Platform.Header.FullPath) \r
+                        raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
+                    else:\r
+                        MergeArches(LibraryClasses, (List[0], List[1]) + tuple(Item[1]), Arch)\r
+        self.Platform.LibraryClasses.IncludeFiles = IncludeFiles\r
+        for Key in LibraryClasses.keys():\r
+            Library = PlatformLibraryClass()\r
+            Library.Name = Key[0]\r
+            Library.FilePath = Key[1]\r
+            Library.ModuleType = list(Key[2:])\r
+            Library.Define = Defines\r
+            Library.SupArchList = LibraryClasses[Key]\r
+            self.Platform.LibraryClasses.LibraryList.append(Library)\r
+        \r
+        #Pcds\r
+        self.GenPcds(DataType.TAB_PCDS_FIXED_AT_BUILD)\r
+        self.GenPcds(DataType.TAB_PCDS_PATCHABLE_IN_MODULE)\r
+        self.GenPcds(DataType.TAB_PCDS_FEATURE_FLAG)\r
+        self.GenDynamicDefaultPcds(DataType.TAB_PCDS_DYNAMIC_DEFAULT)\r
+        self.GenDynamicDefaultPcds(DataType.TAB_PCDS_DYNAMIC_EX_DEFAULT)\r
+        self.GenDynamicHiiPcds(DataType.TAB_PCDS_DYNAMIC_HII)\r
+        self.GenDynamicHiiPcds(DataType.TAB_PCDS_DYNAMIC_EX_HII)\r
+        self.GenDynamicVpdPcds(DataType.TAB_PCDS_DYNAMIC_VPD)\r
+        self.GenDynamicVpdPcds(DataType.TAB_PCDS_DYNAMIC_EX_VPD)\r
+        \r
+        #Components\r
+        Components = {}\r
+        IncludeFiles = {}\r
+        Defines = {}\r
+        for Arch in DataType.ARCH_LIST:\r
+            for Item in self.Contents[Arch].Components:\r
+                (InfFilename, ExecFilename) = GetExec(Item[0])\r
+                LibraryClasses = Item[1]\r
+                BuildOptions = Item[2]\r
+                Pcds = Item[3]\r
+                Component = PlatformModuleClass()\r
+                Component.FilePath = InfFilename\r
+                Component.ExecFilePath = ExecFilename\r
+                for Lib in LibraryClasses:\r
+                    List = GetSplitValueList(Lib)\r
+                    if len(List) != 2:\r
+                        ErrorMsg = "Wrong LibraryClass statement '%s' found in section Components in file '%s', correct format is '<ClassName>|<InfFilename>'" % (Lib, self.Platform.Header.FullPath) \r
+                        raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
+                    Component.LibraryClasses.LibraryList.append(PlatformLibraryClass(List[0], List[1]))\r
+                for BuildOption in BuildOptions:\r
+                    Key = GetBuildOption(BuildOption)\r
+                    Component.ModuleSaBuildOption.BuildOptionList.append(BuildOptionClass(Key[0], Key[1], Key[2]))\r
+                for Pcd in Pcds:\r
+                    Type = Pcd[0]\r
+                    List = GetSplitValueList(Pcd[1])\r
+                    if Type == DataType.TAB_PCDS_FEATURE_FLAG:\r
+                        if len(List) != 3:\r
+                            ErrorMsg = "Wrong Pcds%s statement '%s' found in section Components in file '%s', correct format is '<Cname>|<TokenSpaceGuidCName>|<TrueFalse>'" % (Type, Pcd[1], self.Platform.Header.FullPath) \r
+                            raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
+                        else:\r
+                            Component.PcdBuildDefinitions.append(PcdClass(List[0], '', List[1], '', '', List[2], Type, [], {}, []))\r
+                    if Type == DataType.TAB_PCDS_FIXED_AT_BUILD or Type == DataType.TAB_PCDS_PATCHABLE_IN_MODULE:\r
+                        if len(List.append('')) < 4:\r
+                            ErrorMsg = "Wrong Pcds%s statement '%s' found in section Components in file '%s', correct format is '<Cname>|<TokenSpaceGuidCName>|<Value>[|<MaxDatumSize>]'" % (Type, Pcd[1], self.Platform.Header.FullPath) \r
+                            raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
+                        else:\r
+                            Component.PcdBuildDefinitions.append(PcdClass(List[0], '', List[1], '', List[3], List[2], Type, [], {}, []))\r
+                    if Type == DataType.TAB_PCDS_DYNAMIC or Type == DataType.TAB_PCDS_DYNAMIC_EX:\r
+                        if len(List) != 2:\r
+                            ErrorMsg = "Wrong Pcds%s statement '%s' found in section Components in file '%s', correct format is '<Cname>|<TokenSpaceGuidCName>|<Value>[|<MaxDatumSize>]'" % (Type, Pcd[1], self.Platform.Header.FullPath) \r
+                            raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
+                        else:\r
+                            Component.PcdBuildDefinitions.append(PcdClass(List[0], '', List[1], '', List[3], List[2], Type, [], {}, []))                        \r
+                    \r
+                if GenInclude(Item[0], IncludeFiles, Arch):\r
+                    continue\r
+                Status = GenDefines(Item[0], Arch, Defines)\r
+                if Status == 0:       # Find DEFINE statement\r
+                    pass\r
+                elif Status == -1:    # Find DEFINE statement but in wrong format\r
+                    ErrorMsg = "Wrong DEFINE statement '%s' found in section LibraryClasses in file '%s', correct format is 'DEFINE <VarName> = <PATH>'" % (Item, self.Platform.Header.FullPath) \r
+                    raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
+                elif Status == 1:     # Not find DEFINE statement\r
+                    MergeArches(Components, Component, Arch)\r
+        self.Platform.Modules.IncludeFiles = IncludeFiles\r
+        for Key in Components.keys():\r
+            Key.Define = Defines\r
+            Key.SupArchList = Components[Key]\r
+            self.Platform.Modules.ModuleList.append(Key)\r
         \r
+    #End of DscToPlatform\r
+    \r
+    def GenPcds(self, Type = ''):\r
+        Pcds = {}\r
+        Items = []\r
+        for Arch in DataType.ARCH_LIST:\r
+            if Type == DataType.TAB_PCDS_FIXED_AT_BUILD:\r
+                Items = self.Contents[Arch].PcdsFixedAtBuild\r
+            elif Type == DataType.TAB_PCDS_PATCHABLE_IN_MODULE:\r
+                Items = self.Contents[Arch].PcdsPatchableInModule\r
+            elif Type == DataType.TAB_PCDS_FEATURE_FLAG:\r
+                Items = self.Contents[Arch].PcdsFeatureFlag\r
+            else:\r
+                pass\r
+            \r
+            for Item in Items:\r
+                List = GetSplitValueList(Item + DataType.TAB_VALUE_SPLIT)\r
+                if len(List) < 4:\r
+                    ErrorMsg = "Wrong statement '%s' found in section %s in file '%s', correct format is '<PcdTokenName>|<PcdTokenSpaceGuidCName>|<Value>[|<MaximumDatumSize>]'" % (Item, Type, self.Platform.Header.FullPath) \r
+                    raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
+                else:\r
+                    MergeArches(Pcds, (List[0], List[1], List[2], List[3], Type), Arch)\r
+        for Key in Pcds:\r
+            Pcd = PcdClass(Key[0], '', Key[1], '', Key[3], Key[2], Key[4], [], {}, [])\r
+            Pcd.SupArchList = Pcds[Key]\r
+            self.Platform.DynamicPcdBuildDefinitions.append(Pcd)\r
+    \r
+    def GenSkuInfoList(self, SkuNameList, SkuInfo, VariableName = '', VariableGuid = '', VariableOffset = '', HiiDefaultValue = '', VpdOffset = '', DefaultValue = ''):\r
+        if SkuNameList == None or SkuNameList == [] or SkuNameList == ['']:\r
+                SkuNameList = ['DEFAULT']\r
+        SkuInfoList = {}\r
+        for Item in SkuNameList:\r
+            if Item not in SkuInfo:\r
+                return False, Item\r
+            Sku = SkuInfoClass(Item, SkuInfo[Item], VariableName, VariableGuid, VariableOffset, HiiDefaultValue, VpdOffset, DefaultValue)\r
+            SkuInfoList[Item] = Sku\r
         \r
-    def showDsc(self):\r
+        return True, SkuInfoList\r
+            \r
+    def GenDynamicDefaultPcds(self, Type = ''):\r
+        Pcds = {}\r
+        Items = []\r
+        SkuInfoList = {}\r
+        for Arch in DataType.ARCH_LIST:\r
+            if Type == DataType.TAB_PCDS_DYNAMIC_DEFAULT:\r
+                Items = self.Contents[Arch].PcdsDynamicDefault\r
+            elif Type == DataType.TAB_PCDS_DYNAMIC_EX_DEFAULT:\r
+                Items = self.Contents[Arch].PcdsDynamicExDefault\r
+            else:\r
+                pass\r
+            \r
+            for Item in Items:\r
+                List = GetSplitValueList(Item[0] + DataType.TAB_VALUE_SPLIT)\r
+                if len(List) < 4:\r
+                    ErrorMsg = "Wrong statement '%s' found in section %s in file '%s', correct format is '<PcdTokenName>|<PcdTokenSpaceGuidCName>|<Value>[|<MaximumDatumSize>]'" % (Item, Type, self.Platform.Header.FullPath) \r
+                    raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
+                else:\r
+                    MergeArches(Pcds, (List[0], List[1], List[2], List[3], Type), Arch)\r
+        for Key in Pcds:\r
+            (Status, SkuInfoList) = self.GenSkuInfoList(Item[1], self.Platform.SkuInfos.SkuInfoList, '', '', '', '', '', Key[2])\r
+            if Status == False:\r
+                ErrorMsg = "SKUID '%s' of '%s' not defined in file '%s'" % (SkuInfoList, Type, self.Platform.Header.FullPath) \r
+                raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
+            Pcd = PcdClass(Key[0], '', Key[1], '', Key[3], '', Key[4], [], SkuInfoList, [])\r
+            Pcd.SupArchList = Pcds[Key]\r
+            self.Platform.DynamicPcdBuildDefinitions.append(Pcd)\r
+         \r
+    def GenDynamicHiiPcds(self, Type = ''):\r
+        Pcds = {}\r
+        Items = []\r
+        SkuInfoList = {}\r
+        for Arch in DataType.ARCH_LIST:\r
+            if Type == DataType.TAB_PCDS_DYNAMIC_HII:\r
+                Items = self.Contents[Arch].PcdsDynamicHii\r
+            elif Type == DataType.TAB_PCDS_DYNAMIC_EX_HII:\r
+                Items = self.Contents[Arch].PcdsDynamicExHii\r
+            else:\r
+                pass\r
+            \r
+            for Item in Items:\r
+                List = GetSplitValueList(Item[0] + DataType.TAB_VALUE_SPLIT)\r
+                if len(List) < 7:\r
+                    ErrorMsg = "Wrong statement '%s' found in section %s in file '%s', correct format is '<PcdTokenName>|<PcdTokenSpaceGuidCName>|<String>|<VariableGuidCName>|<VariableOffset>|<DefaultValue>[|<MaximumDatumSize>]'" % (Item, Type, self.Platform.Header.FullPath) \r
+                    raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
+                else:\r
+                    MergeArches(Pcds, (List[0], List[1], List[2], List[3], List[4], List[5], List[6], Type), Arch)\r
+        for Key in Pcds:\r
+            (Status, SkuInfoList) = self.GenSkuInfoList(Item[1], self.Platform.SkuInfos.SkuInfoList, List[3], List[4], List[5], List[6], '', '')\r
+            if Status == False:\r
+                ErrorMsg = "SKUID '%s' of '%s' not defined in file '%s'" % (SkuInfoList, Type, self.Platform.Header.FullPath) \r
+                raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
+            Pcd = PcdClass(Key[0], '', Key[1], '', Key[3], '', Key[7], [], SkuInfoList, [])\r
+            Pcd.SupArchList = Pcds[Key]\r
+            self.Platform.DynamicPcdBuildDefinitions.append(Pcd)\r
+    \r
+    def GenDynamicVpdPcds(self, Type = ''):\r
+        Pcds = {}\r
+        Items = []\r
+        SkuInfoList = {}\r
+        for Arch in DataType.ARCH_LIST:\r
+            if Type == DataType.TAB_PCDS_DYNAMIC_VPD:\r
+                Items = self.Contents[Arch].PcdsDynamicVpd\r
+            elif Type == DataType.TAB_PCDS_DYNAMIC_EX_VPD:\r
+                Items = self.Contents[Arch].PcdsDynamicExVpd\r
+            else:\r
+                pass\r
+            \r
+            for Item in Items:\r
+                List = GetSplitValueList(Item[0] + DataType.TAB_VALUE_SPLIT)\r
+                if len(List) < 4:\r
+                    ErrorMsg = "Wrong statement '%s' found in section %s in file '%s', correct format is '<PcdTokenName>|<PcdTokenSpaceGuidCName>|<DefaultValue>[|<MaximumDatumSize>]'" % (Item, Type, self.Platform.Header.FullPath) \r
+                    raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
+                else:\r
+                    MergeArches(Pcds, (List[0], List[1], List[2], List[3], Type), Arch)\r
+        for Key in Pcds:\r
+            (Status, SkuInfoList) = self.GenSkuInfoList(Item[1], self.Platform.SkuInfos.SkuInfoList, '', '', '', '', List[2], '')\r
+            if Status == False:\r
+                ErrorMsg = "SKUID '%s' of '%s' not defined in file '%s'" % (SkuInfoList, Type, self.Platform.Header.FullPath) \r
+                raise ParserError(PARSER_ERROR, msg = ErrorMsg)\r
+            Pcd = PcdClass(Key[0], '', Key[1], '', Key[3], '', Key[4], [], SkuInfoList, [])\r
+            Pcd.SupArchList = Pcds[Key]\r
+            self.Platform.DynamicPcdBuildDefinitions.append(Pcd)\r
+    \r
+    def ShowDsc(self):\r
         print TAB_SECTION_START + TAB_INF_DEFINES + TAB_SECTION_END\r
         printDict(self.Defines.DefinesDictionary)\r
 \r
@@ -153,7 +446,45 @@ class Dsc(DscObject):
                                     key + DataType.TAB_SPLIT + arch + \\r
                                     "' + TAB_SECTION_END, self.Contents[arch]." + key + ')'\r
                 eval(Command)\r
-        \r
+       \r
+    def ShowPlatform(self):\r
+        m = self.Platform\r
+        print 'Filename =', m.Header.FileName\r
+        print 'FullPath =', m.Header.FullPath\r
+        print 'BaseName =', m.Header.Name\r
+        print 'Guid =', m.Header.Guid\r
+        print 'Version =', m.Header.Version\r
+        print 'DscSpecification =', m.Header.DscSpecification\r
+        print 'SkuId =', m.Header.SkuIdName\r
+        print 'SupArchList =', m.Header.SupArchList\r
+        print 'BuildTargets =', m.Header.BuildTargets\r
+        print 'OutputDirectory =', m.Header.OutputDirectory\r
+        print 'BuildNumber =', m.Header.BuildNumber\r
+        print 'MakefileName =', m.Header.MakefileName\r
+        print 'Fdf =', m.FlashDefinitionFile.FilePath\r
+        print '\nBuildOptions =', m.BuildOptions, m.BuildOptions.IncludeFiles\r
+        for Item in m.BuildOptions.BuildOptionList:\r
+            print Item.ToolChainFamily, Item.ToolChain, Item.Option, Item.SupArchList\r
+        print '\nSkuIds =', m.SkuInfos.SkuInfoList, m.SkuInfos.IncludeFiles\r
+        print '\nLibraries =', m.Libraries, m.Libraries.IncludeFiles\r
+        for Item in m.Libraries.LibraryList:\r
+            print Item.FilePath, Item.SupArchList, Item.Define\r
+        print '\nLibraryClasses =', m.LibraryClasses, m.LibraryClasses.IncludeFiles\r
+        for Item in m.LibraryClasses.LibraryList:\r
+            print Item.Name, Item.FilePath, Item.ModuleType, Item.SupArchList, Item.Define\r
+        print '\nPcds =', m.DynamicPcdBuildDefinitions\r
+        for Item in m.DynamicPcdBuildDefinitions:\r
+            print Item.CName, Item.TokenSpaceGuidCName, Item.DefaultValue, Item.Token, Item.ItemType, Item.MaxDatumSize, Item.SupArchList, Item.SkuInfoList\r
+        print '\nComponents =', m.Modules.ModuleList, m.Modules.IncludeFiles\r
+        for Item in m.Modules.ModuleList:\r
+            print Item.FilePath, Item.ExecFilePath, Item.SupArchList\r
+            for Lib in Item.LibraryClasses.LibraryList:\r
+                print Lib.Name, Lib.FilePath\r
+            for Bo in Item.ModuleSaBuildOption.BuildOptionList:\r
+                print Bo.ToolChainFamily, Bo.ToolChain, Bo.Option\r
+            for Pcd in Item.PcdBuildDefinitions:\r
+                print Pcd.CName, Pcd.TokenSpaceGuidCName, Pcd.MaxDatumSize, Pcd.DefaultValue, Pcd.ItemType\r
+    \r
 if __name__ == '__main__':\r
     p = Dsc()\r
     directory = 'C:\MyWorkspace\\EdkModulePkg'\r
@@ -163,6 +494,6 @@ if __name__ == '__main__':
             fileList.append(os.path.join(directory, os.path.normcase(f)))\r
             \r
     for f in fileList:\r
-        p.LoadDscFile(f)\r
-        p.MergeAllArches()\r
-        p.showDsc()\r
+        p = Dsc(f, True, True)\r
+        #p.ShowDsc()\r
+        p.ShowPlatform()\r