From 4c6e6f9f75a7b86d7760f5409a24b3c20759ccb9 Mon Sep 17 00:00:00 2001 From: "Feng, Bob C" Date: Sat, 15 Dec 2018 00:15:21 +0800 Subject: BaseTools: Fix PcdArray issue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://bugzilla.tianocore.org/show_bug.cgi?id=1390 1. support hex number for array index 2. support Non-Dynamic Pcd for array data type 3. support {} and {CODE()} for array data type 4. Change GetStructurePcdMaxSize to be a static function since it need to be called in another static function. And this function does not depend on it's class instance. 5. Add unittest for RemoveCComments function and ArrayIndex regular expression. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Bob Feng Cc: Liming Gao Cc: Ard Biesheuvel Cc: Philippe Mathieu-Daud? Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Liming Gao --- BaseTools/Source/Python/Workspace/BuildClassObject.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'BaseTools/Source/Python/Workspace/BuildClassObject.py') diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py b/BaseTools/Source/Python/Workspace/BuildClassObject.py index d02232b546..52b3369561 100644 --- a/BaseTools/Source/Python/Workspace/BuildClassObject.py +++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py @@ -19,7 +19,7 @@ from collections import OrderedDict from Common.Misc import CopyDict import copy StructPattern = re.compile(r'[_a-zA-Z][0-9A-Za-z_\[\]]*$') -ArrayIndex = re.compile("\[\s*\d{0,1}\s*\]") +ArrayIndex = re.compile("\[\s*[0-9a-fA-FxX]*\s*\]") ## PcdClassObject # # This Class is used for PcdObject @@ -84,6 +84,7 @@ class PcdClassObject(object): maxsize = item.lstrip("[").rstrip("]").strip() if not maxsize: maxsize = "-1" + maxsize = str(int(maxsize,16)) if maxsize.startswith(("0x","0X")) else maxsize self._Capacity.append(maxsize) if hasattr(self, "SkuOverrideValues"): for sku in self.SkuOverrideValues: -- cgit v1.2.3