git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@517 7335b...
authorhche10x <hche10x@7335b38e-4728-0410-8992-fb3ffe349368>
Wed, 8 Aug 2007 03:47:12 +0000 (03:47 +0000)
committerhche10x <hche10x@7335b38e-4728-0410-8992-fb3ffe349368>
Wed, 8 Aug 2007 03:47:12 +0000 (03:47 +0000)
Source/Python/AutoGen/StrGather.py
Source/Python/AutoGen/UniClassObject.py

index 49e2182..fac5025 100644 (file)
@@ -229,9 +229,9 @@ def SearchString(UniObjectClass, FileList):
                 for StrName in StringTokenList:\r
                     EdkLogger.debug(EdkLogger.DEBUG_5, "Found string identifier: " + StrName)\r
                     UniObjectClass.SetStringReferenced(StrName)\r
-     \r
+    \r
     UniObjectClass.ReToken()\r
-\r
+    \r
     return UniObjectClass\r
 \r
 def GetStringFiles(UniFilList, IncludeList, SkipList, BaseName):\r
@@ -263,42 +263,60 @@ def WriteLine(Target, Item):
 if __name__ == '__main__':\r
     EdkLogger.info('start')\r
     \r
+#    UniFileList = [\r
+#        r'E:\SRC\r9prime\verify\LakeportX64Dev\LakeportX64Pkg\SmbiosMiscDxe\SmbiosMiscStrings.uni',\r
+#        r'E:\SRC\r9prime\verify\LakeportX64Dev\LakeportX64Pkg\SmbiosMiscDxe\MiscOemString.uni',\r
+#        r'E:\SRC\r9prime\verify\LakeportX64Dev\LakeportX64Pkg\SmbiosMiscDxe\MiscSystemOptionString.uni',\r
+#        r'E:\SRC\r9prime\verify\LakeportX64Dev\LakeportX64Pkg\SmbiosMiscDxe\MiscOnboardDevice.uni',\r
+#        r'E:\SRC\r9prime\verify\LakeportX64Dev\LakeportX64Pkg\SmbiosMiscDxe\MiscSystemSlotOnboardDevices.uni',\r
+#        r'E:\SRC\r9prime\verify\LakeportX64Dev\LakeportX64Pkg\SmbiosMiscDxe\MiscBiosVendor.uni',\r
+#        r'E:\SRC\r9prime\verify\LakeportX64Dev\LakeportX64Pkg\SmbiosMiscDxe\MiscChassisManufacturer.uni',\r
+#        r'E:\SRC\r9prime\verify\LakeportX64Dev\LakeportX64Pkg\SmbiosMiscDxe\MiscSystemSlotDesignation.uni',\r
+#        r'E:\SRC\r9prime\verify\LakeportX64Dev\LakeportX64Pkg\SmbiosMiscDxe\MiscPortInternalConnectorDesignator.uni',\r
+#        r'E:\SRC\r9prime\verify\LakeportX64Dev\LakeportX64Pkg\SmbiosMiscDxe\MiscSystemManufacturer.uni',\r
+#    ]\r
+#    IncludeList = [\r
+#        r'E:\SRC\r9prime\verify\LakeportX64Dev\LakeportX64Pkg\SmbiosMiscDxe',\r
+#        r'E:\SRC\r9prime\verify\LakeportX64Dev\Build\LakeportX64Pkg\DEBUG_MYTOOLS\X64\LakeportX64Pkg\SmbiosMiscDxe\SmbiosMiscDxe\DEBUG',\r
+#        r'E:\SRC\r9prime\verify\LakeportX64Dev\MdePkg',\r
+#        r'E:\SRC\r9prime\verify\LakeportX64Dev\MdePkg\Include\x64',\r
+#        r'E:\SRC\r9prime\verify\LakeportX64Dev\MdePkg\Include',\r
+#        r'E:\SRC\r9prime\verify\LakeportX64Dev\IntelFrameworkPkg',\r
+#        r'E:\SRC\r9prime\verify\LakeportX64Dev\IntelFrameworkPkg\Include',\r
+#        r'E:\SRC\r9prime\verify\LakeportX64Dev\MdeModulePkg',\r
+#        r'E:\SRC\r9prime\verify\LakeportX64Dev\MdeModulePkg\Include',\r
+#        r'E:\SRC\r9prime\verify\LakeportX64Dev\LakeportX64Pkg',\r
+#        r'E:\SRC\r9prime\verify\LakeportX64Dev\LakeportX64Pkg\Include',\r
+#    ]\r
+    \r
     UniFileList = [\r
-        r'E:\SRC\r9prime\verify\LakeportX64Dev\LakeportX64Pkg\SmbiosMiscDxe\SmbiosMiscStrings.uni',\r
-        r'E:\SRC\r9prime\verify\LakeportX64Dev\LakeportX64Pkg\SmbiosMiscDxe\MiscOemString.uni',\r
-        r'E:\SRC\r9prime\verify\LakeportX64Dev\LakeportX64Pkg\SmbiosMiscDxe\MiscSystemOptionString.uni',\r
-        r'E:\SRC\r9prime\verify\LakeportX64Dev\LakeportX64Pkg\SmbiosMiscDxe\MiscOnboardDevice.uni',\r
-        r'E:\SRC\r9prime\verify\LakeportX64Dev\LakeportX64Pkg\SmbiosMiscDxe\MiscSystemSlotOnboardDevices.uni',\r
-        r'E:\SRC\r9prime\verify\LakeportX64Dev\LakeportX64Pkg\SmbiosMiscDxe\MiscBiosVendor.uni',\r
-        r'E:\SRC\r9prime\verify\LakeportX64Dev\LakeportX64Pkg\SmbiosMiscDxe\MiscChassisManufacturer.uni',\r
-        r'E:\SRC\r9prime\verify\LakeportX64Dev\LakeportX64Pkg\SmbiosMiscDxe\MiscSystemSlotDesignation.uni',\r
-        r'E:\SRC\r9prime\verify\LakeportX64Dev\LakeportX64Pkg\SmbiosMiscDxe\MiscPortInternalConnectorDesignator.uni',\r
-        r'E:\SRC\r9prime\verify\LakeportX64Dev\LakeportX64Pkg\SmbiosMiscDxe\MiscSystemManufacturer.uni',\r
+        r'C:\SVN\EDKII\Nt32Pkg\PlatformBdsDxe\Generic\FrontPageStrings.uni',\r
+        r'C:\SVN\EDKII\Nt32Pkg\PlatformBdsDxe\Generic\Strings.uni',\r
+        r'C:\SVN\EDKII\Nt32Pkg\PlatformBdsDxe\Generic\DeviceMngr\DeviceManagerStrings.uni',\r
+        r'C:\SVN\EDKII\Nt32Pkg\PlatformBdsDxe\Generic\BootMngr\BootManagerStrings.uni',\r
+        r'C:\SVN\EDKII\Nt32Pkg\PlatformBdsDxe\Generic\FrontPageStrings.uni',\r
+        r'C:\SVN\EDKII\Nt32Pkg\PlatformBdsDxe\Generic\BootMaint\bmstring.uni'\r
     ]\r
+\r
     IncludeList = [\r
-        r'E:\SRC\r9prime\verify\LakeportX64Dev\LakeportX64Pkg\SmbiosMiscDxe',\r
-        r'E:\SRC\r9prime\verify\LakeportX64Dev\Build\LakeportX64Pkg\DEBUG_MYTOOLS\X64\LakeportX64Pkg\SmbiosMiscDxe\SmbiosMiscDxe\DEBUG',\r
-        r'E:\SRC\r9prime\verify\LakeportX64Dev\MdePkg',\r
-        r'E:\SRC\r9prime\verify\LakeportX64Dev\MdePkg\Include\x64',\r
-        r'E:\SRC\r9prime\verify\LakeportX64Dev\MdePkg\Include',\r
-        r'E:\SRC\r9prime\verify\LakeportX64Dev\IntelFrameworkPkg',\r
-        r'E:\SRC\r9prime\verify\LakeportX64Dev\IntelFrameworkPkg\Include',\r
-        r'E:\SRC\r9prime\verify\LakeportX64Dev\MdeModulePkg',\r
-        r'E:\SRC\r9prime\verify\LakeportX64Dev\MdeModulePkg\Include',\r
-        r'E:\SRC\r9prime\verify\LakeportX64Dev\LakeportX64Pkg',\r
-        r'E:\SRC\r9prime\verify\LakeportX64Dev\LakeportX64Pkg\Include',\r
+        r'C:\SVN\EDKII\Nt32Pkg\PlatformBdsDxe\Generic\BootMngr',\r
+        r'C:\SVN\EDKII\Nt32Pkg\PlatformBdsDxe\Generic',\r
+        r'C:\SVN\EDKII\Nt32Pkg\PlatformBdsDxe\Generic\DeviceMngr',\r
+        r'C:\SVN\EDKII\Nt32Pkg\PlatformBdsDxe\Generic\BootMaint',\r
+        r'C:\SVN\EDKII\Nt32Pkg\PlatformBdsDxe',\r
+        r'C:\SVN\EDKII\Build\NT32\DEBUG_MYTOOLS\IA32\Nt32Pkg\PlatformBdsDxe\PlatformBdsDxe\DEBUG',\r
+        r'C:\SVN\EDKII\Nt32Pkg',\r
+        r'C:\SVN\EDKII\Nt32Pkg\Include',\r
+        r'C:\SVN\EDKII\MdePkg',\r
+        r'C:\SVN\EDKII\MdePkg\Include',\r
+        r'C:\SVN\EDKII\MdePkg\Include\Ia32',\r
+        r'C:\SVN\EDKII\IntelFrameworkPkg',\r
+        r'C:\SVN\EDKII\IntelFrameworkPkg\Include',\r
+        r'C:\SVN\EDKII\IntelFrameworkModulePkg',\r
+        r'C:\SVN\EDKII\IntelFrameworkModulePkg\Include',\r
+        r'C:\SVN\EDKII\MdeModulePkg',\r
+        r'C:\SVN\EDKII\MdeModulePkg\Include'\r
     ]\r
-#    UniFileList = (['C:\\Tiano\\Edk\\Sample\\Platform\\Generic\\Dxe\\PlatformBds\\DeviceMngr\\DeviceManagerStrings.uni'])\r
-#    UniFileList.append('C:\\Tiano\\Edk\\Sample\\Platform\\Generic\\Dxe\\PlatformBds\\BootMngr\\BootManagerStrings.uni')\r
-#    UniFileList.append('C:\\Tiano\\Edk\\Sample\\Platform\\Generic\\Dxe\\PlatformBds\\Strings.uni')\r
-#    UniFileList.append('C:\\Tiano\\Edk\\Sample\\Platform\\Generic\\Dxe\\PlatformBds\\FrontPageStrings.uni')\r
-#\r
-#    IncludeList = ['C:\\Tiano\\Edk\\Sample\\Platform\\Generic\\']\r
-#    IncludeList.append('C:\\Tiano\\Edk\\Sample\\Platform\\Generic\\Dxe\\PlatformBds\\BootMngr\\')\r
-#    IncludeList.append('C:\\Tiano\\Edk\\Sample\\Platform\\Generic\\Dxe\\')\r
-#    IncludeList.append('C:\\Tiano\\Edk\\Sample\\Platform\\Generic\\Dxe\\PlatformBds\\')\r
-#    IncludeList.append('C:\\Tiano\\Edk\\Sample\\Platform\\Generic\\Dxe\\PlatformBds\\DeviceMngr\\')\r
-   \r
     \r
     SkipList = ['.inf', '.uni']\r
     BaseName = 'SetupBrowser'\r
index 80f3d06..68b354b 100644 (file)
@@ -247,7 +247,7 @@ class UniFileClassObject(object):
             for File in FileList:\r
                 self.LoadUniFile(File)\r
                 \r
-    def AddStringToList(self, Name, Language, Value, Token = None, Referenced = False, UseOtherLangDef = ''):\r
+    def AddStringToList(self, Name, Language, Value, Token = None, Referenced = False, UseOtherLangDef = '', Index = -1):\r
         if Language not in self.OrderedStringList:\r
             self.OrderedStringList[Language] = []\r
         \r
@@ -258,7 +258,10 @@ class UniFileClassObject(object):
                 break\r
         if not IsAdded:\r
             Token = len(self.OrderedStringList[Language])\r
-            self.OrderedStringList[Language].append(StringDefClassObject(Name, Value, Referenced, Token, UseOtherLangDef))\r
+            if Index == -1:\r
+                self.OrderedStringList[Language].append(StringDefClassObject(Name, Value, Referenced, Token, UseOtherLangDef))\r
+            else:\r
+                self.OrderedStringList[Language].insert(Index, StringDefClassObject(Name, Value, Referenced, Token, UseOtherLangDef))\r
     \r
     def SetStringReferenced(self, Name):\r
         for Lang in self.OrderedStringList:\r
@@ -285,11 +288,12 @@ class UniFileClassObject(object):
                 Name = Item.StringName\r
                 Value = Item.StringValue[0:-1]\r
                 Referenced = Item.Referenced\r
+                Index = self.OrderedStringList[LangKey].index(Item)\r
                 for IndexJ in range(0, len(self.LanguageDef)):\r
                     LangFind = self.LanguageDef[IndexJ][0]\r
                     if self.FindStringValue(Name, LangFind) == None:\r
                         Token = len(self.OrderedStringList[LangFind])\r
-                        self.AddStringToList(Name, LangFind, Value, Token, Referenced, LangKey)\r
+                        self.AddStringToList(Name, LangFind, Value, Token, Referenced, LangKey, Index)\r
         \r
         #\r
         # Retoken\r
@@ -310,14 +314,17 @@ class UniFileClassObject(object):
             for Index in range(len(NotReferencedStringList)):\r
                 NotReferencedStringList[Index].Token = Token + Index\r
                 self.OrderedStringList[LangName].append(NotReferencedStringList[Index])\r
+        \r
+    def ShowMe(self):\r
+        print self.LanguageDef\r
+        #print self.OrderedStringList\r
+        for Item in self.OrderedStringList:\r
+            print Item\r
+            for Member in self.OrderedStringList[Item]:\r
+                print str(Member)\r
             \r
 # This acts like the main() function for the script, unless it is 'import'ed into another\r
 # script.\r
 if __name__ == '__main__':\r
     a = UniFileClassObject(['C:\\Tiano\\Edk\\Sample\\Universal\\UserInterface\\SetupBrowser\\Dxe\\DriverSample\\inventorystrings.uni', 'C:\\Tiano\\Edk\\Sample\\Universal\\UserInterface\\SetupBrowser\\Dxe\\DriverSample\\VfrStrings.uni'])\r
-    print a.LanguageDef\r
-    print a.OrderedStringList\r
-    for i in a.OrderedStringList:\r
-        print i\r
-        for m in a.OrderedStringList[i]:\r
-            print str(m)\r
+    a.ShowMe()\r