ECC: fix regular expression for function declaration.
authorjlin16 <jlin16@7335b38e-4728-0410-8992-fb3ffe349368>
Fri, 11 Apr 2008 08:49:22 +0000 (08:49 +0000)
committerjlin16 <jlin16@7335b38e-4728-0410-8992-fb3ffe349368>
Fri, 11 Apr 2008 08:49:22 +0000 (08:49 +0000)
git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@1143 7335b38e-4728-0410-8992-fb3ffe349368

Source/Python/Ecc/c.py

index 92b81e6..91b5605 100644 (file)
@@ -20,7 +20,7 @@ def GetIgnoredDirListPattern():
     return p\r
 \r
 def GetFuncDeclPattern():\r
-    p = re.compile(r'[_\w]*\s*\(.*\).*', re.DOTALL)\r
+    p = re.compile(r'(EFIAPI|EFI_BOOT_SERVICE|EFI_RUNTIME_SERVICE)?\s*[_\w]+\s*\(.*\).*', re.DOTALL)\r
     return p\r
 \r
 def GetArrayPattern():\r
@@ -90,6 +90,16 @@ def GetIdentifierList():
             DeclText = DeclText.lstrip('*').strip()\r
         var.Declarator = DeclText\r
         if FuncDeclPattern.match(var.Declarator):\r
+            DeclSplitList = var.Declarator.split('(')     \r
+            FuncName = DeclSplitList[0]\r
+            FuncNamePartList = FuncName.split()\r
+            if len(FuncNamePartList) > 1:\r
+                FuncName = FuncNamePartList[-1]\r
+                Index = 0\r
+                while Index < len(FuncNamePartList) - 1:\r
+                    var.Modifier += ' ' + FuncNamePartList[Index]\r
+                    var.Declarator = var.Declarator.lstrip().lstrip(FuncNamePartList[Index])\r
+                    Index += 1\r
             IdVar = DataClass.IdentifierClass(-1, var.Modifier, '', var.Declarator, '', DataClass.MODEL_IDENTIFIER_FUNCTION_DECLARATION, -1, -1, var.StartPos[0],var.StartPos[1],var.EndPos[0],var.EndPos[1])\r
             IdList.append(IdVar)\r
             continue\r