From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web10.7110.1614226841335228153 for ; Wed, 24 Feb 2021 20:20:41 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=N2qMvCIb; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: bob.c.feng@intel.com) IronPort-SDR: PGKeblzmcW5dszfZ0474JpR1pqfVA+0EzYD656ksMI24UmfFNEOGuTpVQjkT7T0MvjKwAVAYB4 4PaQ9Qu89FJw== X-IronPort-AV: E=McAfee;i="6000,8403,9905"; a="184703776" X-IronPort-AV: E=Sophos;i="5.81,203,1610438400"; d="scan'208";a="184703776" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Feb 2021 20:20:39 -0800 IronPort-SDR: slWdBPgrupeMejqTmigLZoTIOUni0wfjUxeRQmRsdGzJzTJqn/U5duZieKMlrPEuaea0I/n2Yd Ok0hkwOjR6IQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,203,1610438400"; d="scan'208";a="367251408" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by orsmga006.jf.intel.com with ESMTP; 24 Feb 2021 20:20:38 -0800 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Wed, 24 Feb 2021 20:20:38 -0800 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Wed, 24 Feb 2021 20:20:38 -0800 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.36.55) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2106.2; Wed, 24 Feb 2021 20:20:37 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JIH4ytaXKfrcRTVczKpgHHMu8Zv5wlidmWvtONab2eKfseJS7Gntxchrmcsp9J9WyfFEvgNkimtCSRwOH4t1z4j30aJTL7SP11etUjerEmlkJWLDvvbFpnTJ6/nqt1tybqg9Y8Zcqf131xbCT5NazmQyeFy4351lzUuPf8LDZxT4f537p82LNZd26wzX2NUaZ1k6sUS0C7ofESiwVVzkHuGFkBYMvDJcL1rYpuqb/3Grb7xDS6tUmBSGCFwpOWVWJ7RLdRMQYpewB0h2DNs8IL/WOBXQYPcBZrVVSUgshW0Ph0v8k7HFVlbvx47J53ZboFZkoq8jisrM/peyF1zk8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=013pZPegxDmPEQxnbCScBfaBFeyBXm8Wq3Y3ZNne/1M=; b=j2BjZsDZRXU+givj6u2X/q75TTFmyOrsIL6EqX00i2eTEcwdeJihtxfZskKzmS9XUJ6sUVIviZ5SGKfnPFxMAKqyLy0S0QSTZGVu+oMoUneIof2QLojVRJcmcS7wsEJ+ZE/MgqW+qHO4T4razyn9UBOKGQWGPOfCdF3brXxdOnv9WEDj/PyYEal61tmu+QqQVXFfprV46aYslLhfaQqmya5tr8cil1V78Bt1VAfeQ1cUHZmoC2fMZcYA+Si/gtotnx4og6mWnhcEra0saRNha9Cj0d9gkqYvjcCZOoHTlakTsl/XL42YnEkJkOCd7c5+MNLrwhPXmag/u2lDW8Pgrg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=013pZPegxDmPEQxnbCScBfaBFeyBXm8Wq3Y3ZNne/1M=; b=N2qMvCIbO33dj95yAeKXnrcSx49G59jeDlJ/Su4ayHoDfl1EgVc8AaX4JxRBlULBD/3d6qp+lOh5Uzgp7Egauz6jmgil6hf7qhy5gKQiuIlzfFSC58eStneDbmDlPGQej7XK+vBx8yPHlerJYPuyfT4gB2yy145K4yhr9NCb0eg= Received: from DM6PR11MB4073.namprd11.prod.outlook.com (2603:10b6:5:19f::22) by DM6PR11MB2859.namprd11.prod.outlook.com (2603:10b6:5:c9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Thu, 25 Feb 2021 04:20:36 +0000 Received: from DM6PR11MB4073.namprd11.prod.outlook.com ([fe80::845:55b:f6b3:aa0a]) by DM6PR11MB4073.namprd11.prod.outlook.com ([fe80::845:55b:f6b3:aa0a%6]) with mapi id 15.20.3846.048; Thu, 25 Feb 2021 04:20:36 +0000 From: "Bob Feng" To: "Chen, Christine" , "devel@edk2.groups.io" CC: Liming Gao Subject: Re: [PATCH 1/1] BaseTools: Adjust StructurePcd List Order. Thread-Topic: [PATCH 1/1] BaseTools: Adjust StructurePcd List Order. Thread-Index: AQHW1A8Zh9abd+7+yka1n5DNkJU76qpost7g Date: Thu, 25 Feb 2021 04:20:36 +0000 Message-ID: References: <20201217005348.1529-1-yuwei.chen@intel.com> In-Reply-To: <20201217005348.1529-1-yuwei.chen@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.102.204.37] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 84f0f004-2a49-4aff-dea8-08d8d944b3b5 x-ms-traffictypediagnostic: DM6PR11MB2859: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2150; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: NvXonmCzEIiKKHyZUpoyd+1YF3Vn6YOyAlXlVYYyEciM9BdMDlVMXUy0TlTuG8wHc2bIwP5+CXIV5a/4fqjZNGBhLGhawCjUheWGjmwChH15e+WbR3UJq8tVqoCCVhXq6+Kwfda0bnvaafJTRpqzYuTICARVWsLC9hLFkwohWkXzChgKSmJAj5fcnenJbSEm87S2HPpmEaBC5qM1ywG+E4gLSqlWDDmsGH0Mf6+UVaPvBen6GTttoTR8crA0RzTDx0xaV686XLz22wLwyZ4WdjzC0ROKoGoW4IT5DvVT+H3CC3Kf/Vx8ZqnBQaOEWvxyYtM5pFEEXhd/cVggZOWjH+qK3MAD/9IFc6TwFjCSxHZPAXjFZAwvL6VWvoIrUdQe8wruV50xm9p7AZPmRRv0/sTem/+RuPzZS6rSKCloxs4BZPF2N/VrusX474woq1//DHMMsZ0GY7Gv75TccItDa02ryFsXAp4KN4LXMUUDZ4X2xlwOECH6t3Z3bnCxU/3bujLbwLi8zksJvIwdu077vg== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR11MB4073.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(39860400002)(346002)(136003)(376002)(366004)(76116006)(316002)(83380400001)(66946007)(478600001)(86362001)(8936002)(4326008)(64756008)(9686003)(66476007)(55016002)(186003)(52536014)(110136005)(66446008)(6506007)(8676002)(33656002)(7696005)(2906002)(26005)(53546011)(5660300002)(66556008)(71200400001);DIR:OUT;SFP:1102; x-ms-exch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soye/bUodWwAR0qTOBszIfCPpSL9CphT/QaSO3ffIl?= =?us-ascii?Q?IUZbVUnH9ijx1eDs663QVXTwD3r4W+1bV/V7HpJ3y9wIJy1e0D+XM5OjU5zV?= =?us-ascii?Q?Oof3mf4CG7C8nJc171lSGPWfg30hLKTe4A5rBm9VGKU5eJ7OgOEXjFvJ4y9n?= =?us-ascii?Q?ymUQ6cYkHcpokp9CGW9KwoVbHyh0EuwbQ2YkKR2sKmPF40obLTB4vZu73nTy?= =?us-ascii?Q?HJP+dIGFUWEdvwl+meHaYPi+qve1QWaG0seOJBWHlb2hxp4YKaL/vZHBU4qC?= =?us-ascii?Q?00URz6UVdQ/Wwz7xIvdgurvMFfq6TZ+nqhyGj26AqcsavEkZ64lSTbrdiMAX?= =?us-ascii?Q?IUeIvRdEsKW8GMTjrF6sLgwe3eHki9/FfrRULgWutAK0OW46CmfRGeNTBjMS?= =?us-ascii?Q?PaWQyD8RGBUatpZ2sl3H5IFEIbs/AQ5Fxo+pBLvAc0aPqNxW8WFJj6WZsZ49?= =?us-ascii?Q?SNpVh+ykTxlDdw3Kd3Gt9qUB?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB4073.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 84f0f004-2a49-4aff-dea8-08d8d944b3b5 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Feb 2021 04:20:36.7670 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: RWfTZ0iTu1e1YnE71JiBv3j2KtXlELoGIRLFFpesgWMBcR9istNjztsx+EndfDn7hPbaxvQohAh+pMxP1iOkfw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB2859 Return-Path: bob.c.feng@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Bob Feng -----Original Message----- From: Chen, Christine =20 Sent: Thursday, December 17, 2020 8:54 AM To: devel@edk2.groups.io Cc: Feng, Bob C ; Liming Gao Subject: [PATCH 1/1] BaseTools: Adjust StructurePcd List Order. Currently StructurePcd.dsc have the list order issue. For a Pcd with severa= l elements, the list indexs are used to distinguish these elements like thi= s: PcdName.name.offset_name[0]|0x0 PcdName.name.offset_name[10]|0x0 PcdName.name.offset_name[11]|0x0 ... PcdName.name.offset_name[2]|0x0 ... However, the index is not strictly sorted by decimal numerical order, which= is not user friendly. One more sort rule for index is added to the current= rules to support for decimal numerical order in this patch. Cc: Bob Feng Cc: Liming Gao Signed-off-by: Yuwei Chen --- BaseTools/Scripts/ConvertFceToStructurePcd.py | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/BaseTools/Scripts/ConvertFceToStructurePcd.py b/BaseTools/Scri= pts/ConvertFceToStructurePcd.py index 867660fba9cf..91361ea2b94d 100644 --- a/BaseTools/Scripts/ConvertFceToStructurePcd.py +++ b/BaseTools/Scripts/ConvertFceToStructurePcd.py @@ -277,6 +277,7 @@ class Config(object): attribute_re=3Dre.compile(r'attribute=3D(\w+)') value_re =3D re.compile(r'(//.*)') part =3D [] + part_without_comment =3D [] for x in section[1:]: line=3Dx.split('\n')[0] comment_list =3D value_re.findall(line) # the string \\... in "Q..= .." line @@ -293,8 +294,18 @@ class Config(object): if attribute[0] in ['0x3','0x7']: offset =3D int(offset[0], 16) #help =3D help_re.findall(x) - text =3D offset, name[0], guid[0], value, attribute[0], commen= t - part.append(text) + text_without_comment =3D offset, name[0], guid[0], value, attr= ibute[0] + if text_without_comment in part_without_comment: + # check if exists same Pcd with different comments, add di= fferent comments in one line with "|". + dupl_index =3D part_without_comment.index(text_without_com= ment) + part[dupl_index] =3D list(part[dupl_index]) + if comment not in part[dupl_index][-1]: + part[dupl_index][-1] +=3D " | " + comment + part[dupl_index] =3D tuple(part[dupl_index]) + else: + text =3D offset, name[0], guid[0], value, attribute[0], co= mment + part_without_comment.append(text_without_comment) + part.append(text) return(part) =20 def value_parser(self, list1): @@ -532,6 +543,18 @@ class mainprocess(object): i.sort() return keys,title_all,info_list,header_list,inf_list =20 + def correct_sort(self, PcdString): + # sort the Pcd list with two rules: + # First sort through Pcd name; + # Second if the Pcd exists several elements, sort them through index v= alue. + if ("]|") in PcdString: + Pcdname =3D PcdString.split("[")[0] + Pcdindex =3D int(PcdString.split("[")[1].split("]")[0]) + else: + Pcdname =3D PcdString.split("|")[0] + Pcdindex =3D 0 + return Pcdname, Pcdindex + def remove_bracket(self,List): for i in List: for j in i: @@ -543,7 +566,7 @@ class mainprocess(object): List[List.index(i)][i.index(j)] =3D j for i in List: if type(i) =3D=3D type([0,0]): - i.sort() + i.sort(key =3D lambda x:(self.correct_sort(x)[0],=20 + self.correct_sort(x)[1])) return List =20 def write_all(self): -- 2.27.0.windows.1