From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web12.1219.1628205507973435893 for ; Thu, 05 Aug 2021 16:18:28 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=jgwP2+DU; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: nathaniel.l.desimone@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10067"; a="194545509" X-IronPort-AV: E=Sophos;i="5.84,296,1620716400"; d="scan'208";a="194545509" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Aug 2021 16:18:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,296,1620716400"; d="scan'208";a="569576265" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by orsmga004.jf.intel.com with ESMTP; 05 Aug 2021 16:18:26 -0700 Received: from fmsmsx605.amr.corp.intel.com (10.18.126.85) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Thu, 5 Aug 2021 16:18:25 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4 via Frontend Transport; Thu, 5 Aug 2021 16:18:25 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.173) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Thu, 5 Aug 2021 16:18:25 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PLYkq47FDmFVxGkePSx9hm6HY7UpbZ+j7vSagCJEy0P7GgMwMVJnRG/6aDtvAWsL74oIZgSGj2tB9NHHvM+XmBfT8WqvN1EV4qCP2/stG6z55gDrmc4lPkTOuVzGFaRllxZhDnTpPSf5IeEs9sUbAezWnoH824zRPyNMz+2O5k0NIDOraFABm8bZJCg7EqUer1B28GLmnmfTEYiRyVn8hrTZFc4iK9jjLwcr7JiIwEpvzxwg50ohy7bu9eOJmUPHkvYhwGXZYnlMDn6Ys/IhF/lxr6C+ct44Jd7eDqno0x5SRW+EUnQWUnBnyRgGPZx0fcu+hsaN8yZSO6SrtoZE+Q== 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=WNbAQk9rYp1gjpZDrgTq7TqTyG8xGF3PQZbwkTWBecY=; b=IuusFNoTqhh7Ksnpz+1wQXwpJvX7GJam95X8pAb9WYpl46vkftfc+hoyZxezLfCFT15hPUdDVZYcyMOsRuGizOoMslWisJS8Y1hpqrs5axRWjvE3Bc2vPNb4da7X15Ay3vwIc4YvezuOAK3C4GuoxRID0ZUgtj4rXLrzyhQN31kp7BeLIoSRjM2ISgQEsCejl/19kdZbU1WZhkje/QUuJKARYsfzKf4e3BziBBS9evVFx0TJUpL6JkNxEZxWTzVst35SfU5EwKHDYZG0grmmQ66ADjwrvMkJgcemDmj3RJTgl3+NHuJYf5YQF5nCeOMwZoyEcLFqBiuXRcQEKbDa3g== 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=WNbAQk9rYp1gjpZDrgTq7TqTyG8xGF3PQZbwkTWBecY=; b=jgwP2+DURkEZZHStFPvxxHkqxQufFbhfVDkxfEtS/epL43FiKWSdOZYdx0ddHol/ZcSRqGKoS6nYJvSnlzu1V/s1xOxpBFDMf1Mc7Jc4L/yyQr+ryKqiXTAN/lCJLMFCzXCir385KI8jJi3bKARzOafbp+uf79CXajfrVMGYBzU= Received: from MWHPR1101MB2160.namprd11.prod.outlook.com (2603:10b6:301:5b::12) by MW3PR11MB4732.namprd11.prod.outlook.com (2603:10b6:303:2c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.15; Thu, 5 Aug 2021 23:18:24 +0000 Received: from MWHPR1101MB2160.namprd11.prod.outlook.com ([fe80::546c:f20e:35d2:65a7]) by MWHPR1101MB2160.namprd11.prod.outlook.com ([fe80::546c:f20e:35d2:65a7%5]) with mapi id 15.20.4394.017; Thu, 5 Aug 2021 23:18:23 +0000 From: "Nate DeSimone" To: "devel@edk2.groups.io" , "cadenkline9@gmail.com" CC: "Wang, Jian J" , "Wu, Hao A" , "Gao, Zhichao" , "Ni, Ray" Subject: Re: [edk2-devel] [PATCH 1/1] MdeModulePkg/Console: Improve encoding of box drawing characters Thread-Topic: [edk2-devel] [PATCH 1/1] MdeModulePkg/Console: Improve encoding of box drawing characters Thread-Index: AQHXhRWCLF+JOciiCka9S4YHqUVJ1Ktllgdg Date: Thu, 5 Aug 2021 23:18:23 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.5.1.3 dlp-product: dlpe-windows authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0008392d-5c3a-4d0d-3ac8-08d95867528a x-ms-traffictypediagnostic: MW3PR11MB4732: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5236; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: z5Jz2MiV91Lac77XqCgKMCWTckbM8bEnCaN5XD1ic9BHynygOQNocbdhK6QgvOyuFi82y25ONE0UoILc1688aBm+w//v4G6vpYycYYh4VmiTKDJIfdjrPM1ynSPTSDnfGQONr/gFjNi4KMBgDW0GJsCHiko9KGDU6t/GXrNB12F7T77yvPRonjv1OvAfXS6zaKm0XwJli1CbOrM9WL5qEkBz+/SM5SO6YJOVmXAvKYDd58ITa8SNmTp96yPM2ZYXXuFAUj3Qbb8n9Sw5XSpvcbmj6SnhRWJ5FqUuo0UndzqnOPXtSjqpHhYsQvnWlIUZWosmOrmAk+BEvsUDP5GMRZlstEywP+uSesbSk0Ro28YjLz0Ge3xUiC4ZD8+l8lQps3TpMxTQfWBBf2bwfSDk5W2QkiRqpctZNw5aUIrHvOsrrATwveQXp1/GGokjkVtlA3CsBjTrcmlOl7V67DnXBcj3Ox4tFCetB55AAGQUlHRzuuGbGjmZXFHkuVsYZoaUIB2BIUii/lS92wazCBwAnsRz+5r87E0iCzgxBxz6vWSvQxBIcKQKr0CmLsxzkcXRIviIKkhyTn5WMhzT6oScxHv9TgOt5H3stOOLeWhze4Oi1nfu44bhZ0vMGunSU/PFJVm0B78KP0IRp4Vb6+f04lKEMatdxgopaGw/QWg+0scY3dMYSFYgm8rhc+hNK/8pibdLpHlFHUOAQ4HHIs3KDYTNt1/G2CcIIOkBgTG6GY2OhqV4ixzZF08JXfkcdkE4p3O79xSqbT4U1Q3wNCN3m8YvUuxpaV5G0YVZYkXubMvhWt4AXJ/5YtDpe34vwZh1CEpHBYkiguhequDIQi/BtA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1101MB2160.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(366004)(376002)(396003)(346002)(136003)(66946007)(76116006)(107886003)(38070700005)(64756008)(66446008)(316002)(66476007)(6506007)(66556008)(4326008)(54906003)(110136005)(86362001)(33656002)(478600001)(83380400001)(2906002)(71200400001)(5660300002)(7696005)(55016002)(8936002)(9686003)(30864003)(52536014)(186003)(53546011)(8676002)(38100700002)(122000001)(26005)(966005)(579004);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?tN9Shu/fFEqJ/kUDl3jC2OpNRwQIGyx2ssehjW9wTC1525mwxFnPqLwQ21Ow?= =?us-ascii?Q?pkPR0vnqrqr0HOm6Gwvtahja9CjRURp150bM7oo26p5R51odA1mFfmvpXVql?= =?us-ascii?Q?fNs+9r4N3mbL1f2wQxigXA158kz7BIIKN5MbDQmjWaEKddZ+T4ntpUv03U54?= =?us-ascii?Q?Nk8Pem8kyHcVHjYuCKcbX5QSDojh1/ovBOj4h03ZStKRpQul+K9DosmGJZ7s?= =?us-ascii?Q?IUU1E9jVrhuO0fzJ/M1LQHWOE3cqEf4Fo6LDheK3TTFrWQfnUFS3UuNqSMS0?= =?us-ascii?Q?tqnLHODzPkAXvRUqh60TbjdAzpt4ULamPZ1TRr8DLS8Vh2C276Xdn+TkkTYV?= =?us-ascii?Q?A1tGwVafJFvYGOjGclsCsu8UnZW5MdVtQ/awDreeNc9ib5RoiSqLkOfaY7JW?= =?us-ascii?Q?Su7Embs4hNpptETqTII3usmM4qAPTAC0DuTY5CLkPnVO+6GiaWvrg/0vbsLs?= =?us-ascii?Q?5+F153eOD6JEc6DN1qIMOTK7UgmHFQMsUcRhbM9SzhzD1xlYMM4S/PJoKl5Z?= =?us-ascii?Q?MqhCDZE4W0UUZ6l9I74tALofJkYgaDbW732v8z5GN1dlY5IThYy9sHA9bBDa?= =?us-ascii?Q?D29d9Uq3zLFVX/BucAstQM/Xr2LjBJ6EkmFQqBijmbJXvDXvSIGxXL8gLMyg?= =?us-ascii?Q?Cpq4EdavK0yz7u4TiU3pqlkKUgErv5sGhH9jNSkUCZ4KjWymiJ4JmUxJwX4Y?= =?us-ascii?Q?Y3sin3KPPvUB/ES9/Xfy4r20HiieC6o+bG6qpbhHY2PL6vdmAS36Dk+lFwz7?= =?us-ascii?Q?C2jSEl9zJJ48m6HtL4CC8JmXw8PXVui5m00IuiLNr07QNBfQO8SIKBGVr4EG?= =?us-ascii?Q?N938gzCVBJxHK05dyJ+k85A1zFELInoXKL1ocf2G+j7cBCzFFBh/9e9QMBIx?= =?us-ascii?Q?tdlk199LLbDhyfb6PP8LVKOsu0X5Q4sWs7Nj9yyn/X+ScCUtvMpAVslIuDNN?= =?us-ascii?Q?LJzYiJocfsPXC96q0PXbl36uvwgrZFEQQxX6fPHfupd5D3i5f3SIHLmqqFfE?= =?us-ascii?Q?/ryZx3xzhgMjzPRVo1ptd6Wxu0J0ttONeJ9vv1ur9gvFh8BzAs7raab+bdtE?= =?us-ascii?Q?EV4hunXmSfxasRFWueQfkB+0BBWqNgC6PmdxisvU7p698P+tp4/SJ5nNrBsW?= =?us-ascii?Q?t37tlrZ3c6uK4KyAwn0JNPbkxZ9QCnrULzAB1lIzIOW+marAWVH1lsBco7bO?= =?us-ascii?Q?Bz9RmqUfxZjF4WeNuIh7uhySsIEpeLo31cq7U/aibk3M1GzL8+YL6glL3AI7?= =?us-ascii?Q?1ca51+c89l2bV1ZeQNXQTyX/jbYpoxCNfcWIbq34wSBNvLehRquDpam7dpTe?= =?us-ascii?Q?RQDDzWdE0OwIJ0qSq3qpZJLP?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MWHPR1101MB2160.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0008392d-5c3a-4d0d-3ac8-08d95867528a X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Aug 2021 23:18:23.7872 (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: 0woonGeotKIC/LqujO5I3Qs26uVLPsjgQkoMOgbVXUVtvywx6qW/lPqjAywbEOz84AElaSS5/6lUkD2vPJ1LTlWDFOwI2nhQKScZkyCmGUI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR11MB4732 Return-Path: nathaniel.l.desimone@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Caden, Please make sure you test this patch thoroughly. With that... Reviewed-by: Nate DeSimone Thanks! Nate > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Caden > Kline > Sent: Thursday, July 29, 2021 7:45 PM > To: devel@edk2.groups.io > Cc: Wang, Jian J ; Wu, Hao A > ; Gao, Zhichao ; Ni, Ray > > Subject: [edk2-devel] [PATCH 1/1] MdeModulePkg/Console: Improve > encoding of box drawing characters >=20 > Improved encoding of box drawing characters for different terminal types. > This includes Dec special graphics mode and more utf8. >=20 > Cc: Jian J Wang > Cc: Hao A Wu > Cc: Zhichao Gao > Cc: Ray Ni > Signed-off-by: Caden Kline > --- > .../Universal/Console/TerminalDxe/Terminal.h | 24 +- > .../Universal/Console/TerminalDxe/Ansi.c | 2 +- > .../Console/TerminalDxe/TerminalConOut.c | 322 ++++++++++++++---- > 3 files changed, 269 insertions(+), 79 deletions(-) >=20 > diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h > b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h > index 360e58e84743..83c3ea94a042 100644 > --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h > +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h > @@ -122,7 +122,10 @@ typedef struct { > EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL SimpleInputEx; LIST_ENTRY > NotifyList; EFI_EVENT KeyNotifyProcessEvent;+= BOOLEAN > DecSpecialGraphicsMode; } TERMINAL_DEV;+// This the lenth the escape > squences for entering and exiting Dec Special Graphics Mode+#define > LENGTH_DEC_ESCAPE 0x03 #define INPUT_STATE_DEFAULT > 0x00 #define INPUT_STATE_ESC 0x01@@ -169,6 +172,7 @@ > typedef struct { > UINT16 Unicode; CHAR8 PcAnsi; CHAR8 Ascii;+ CHAR8 > DecSpecialGraphics; } UNICODE_TO_CHAR; //@@ -1367,20 +1371,22 @@ > Utf8ToUnicode ( > /** Detects if a Unicode char is for Box Drawing text graphics. - @pa= ram > Graphic Unicode char to test.- @param PcAnsi Optional pointe= r to > return PCANSI equivalent of- Graphic.- @param Asc= ii Optional > pointer to return ASCII equivalent of- Graphic.-- = @retval TRUE > If Graphic is a supported Unicode Box Drawing character.+ @param Graphi= c > Unicode char to test.+ @param PcAnsi Optional pointer to r= eturn > PCANSI equivalent of+ Graphic.+ @param Asc= ii > Optional pointer to return ASCII equivalent of+ = Graphic.+ > @param DecSpecialGraphics Optional pointer to return Dec Special Graphi= cs > equivalent of+ Graphic.+ @retval TRUE = If Graphic is a > supported Unicode Box Drawing character. **/ BOOLEAN > TerminalIsValidTextGraphics ( IN CHAR16 Graphic,- OUT CHAR8 *PcAns= i, > OPTIONAL- OUT CHAR8 *Ascii OPTIONAL+ OUT CHAR8 *PcAnsi, > OPTIONAL+ OUT CHAR8 *Ascii, OPTIONAL+ OUT CHAR8 > *DecSpecialGraphics OPTIONAL ); /**diff --git > a/MdeModulePkg/Universal/Console/TerminalDxe/Ansi.c > b/MdeModulePkg/Universal/Console/TerminalDxe/Ansi.c > index f117d90b9de3..5ae5a4f0212e 100644 > --- a/MdeModulePkg/Universal/Console/TerminalDxe/Ansi.c > +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Ansi.c > @@ -63,7 +63,7 @@ AnsiTestString ( > if ( !(TerminalIsValidAscii (*WString) || TerminalIsValidEf= iCntlChar > (*WString) ||- TerminalIsValidTextGraphics (*WString, &GraphicChar= , > NULL) )) {+ TerminalIsValidTextGraphics (*WString, &GraphicChar, N= ULL, > NULL) )) { return EFI_UNSUPPORTED; }diff --git > a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c > b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c > index aae470e9562c..1c22ed426715 100644 > --- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c > +++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c > @@ -16,61 +16,59 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > // // UNICODE_TO_CHAR UnicodeToPcAnsiOrAscii[] =3D {- { > BOXDRAW_HORIZONTAL, 0xc4, L'-' },- { BOXDRAW_VERTICAL, > 0xb3, L'|' },- { BOXDRAW_DOWN_RIGHT, 0xda, L'/' },- { > BOXDRAW_DOWN_LEFT, 0xbf, L'\\' },- { BOXDRAW_UP_RIGHT, > 0xc0, L'\\' },- { BOXDRAW_UP_LEFT, 0xd9, L'/' },- { > BOXDRAW_VERTICAL_RIGHT, 0xc3, L'|' },- { > BOXDRAW_VERTICAL_LEFT, 0xb4, L'|' },- { > BOXDRAW_DOWN_HORIZONTAL, 0xc2, L'+' },- { > BOXDRAW_UP_HORIZONTAL, 0xc1, L'+' },- { > BOXDRAW_VERTICAL_HORIZONTAL, 0xc5, L'+' },- { > BOXDRAW_DOUBLE_HORIZONTAL, 0xcd, L'-' },- { > BOXDRAW_DOUBLE_VERTICAL, 0xba, L'|' },- { > BOXDRAW_DOWN_RIGHT_DOUBLE, 0xd5, L'/' },- { > BOXDRAW_DOWN_DOUBLE_RIGHT, 0xd6, L'/' },- { > BOXDRAW_DOUBLE_DOWN_RIGHT, 0xc9, L'/' },- { > BOXDRAW_DOWN_LEFT_DOUBLE, 0xb8, L'\\' },- { > BOXDRAW_DOWN_DOUBLE_LEFT, 0xb7, L'\\' },- { > BOXDRAW_DOUBLE_DOWN_LEFT, 0xbb, L'\\' },- { > BOXDRAW_UP_RIGHT_DOUBLE, 0xd4, L'\\' },- { > BOXDRAW_UP_DOUBLE_RIGHT, 0xd3, L'\\' },- { > BOXDRAW_DOUBLE_UP_RIGHT, 0xc8, L'\\' },- { > BOXDRAW_UP_LEFT_DOUBLE, 0xbe, L'/' },- { > BOXDRAW_UP_DOUBLE_LEFT, 0xbd, L'/' },- { > BOXDRAW_DOUBLE_UP_LEFT, 0xbc, L'/' },- { > BOXDRAW_VERTICAL_RIGHT_DOUBLE, 0xc6, L'|' },- { > BOXDRAW_VERTICAL_DOUBLE_RIGHT, 0xc7, L'|' },- { > BOXDRAW_DOUBLE_VERTICAL_RIGHT, 0xcc, L'|' },- { > BOXDRAW_VERTICAL_LEFT_DOUBLE, 0xb5, L'|' },- { > BOXDRAW_VERTICAL_DOUBLE_LEFT, 0xb6, L'|' },- { > BOXDRAW_DOUBLE_VERTICAL_LEFT, 0xb9, L'|' },- { > BOXDRAW_DOWN_HORIZONTAL_DOUBLE, 0xd1, L'+' },- { > BOXDRAW_DOWN_DOUBLE_HORIZONTAL, 0xd2, L'+' },- { > BOXDRAW_DOUBLE_DOWN_HORIZONTAL, 0xcb, L'+' },- { > BOXDRAW_UP_HORIZONTAL_DOUBLE, 0xcf, L'+' },- { > BOXDRAW_UP_DOUBLE_HORIZONTAL, 0xd0, L'+' },- { > BOXDRAW_DOUBLE_UP_HORIZONTAL, 0xca, L'+' },- { > BOXDRAW_VERTICAL_HORIZONTAL_DOUBLE, 0xd8, L'+' },- { > BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL, 0xd7, L'+' },- { > BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL, 0xce, L'+' },+ { > BOXDRAW_HORIZONTAL, 0xc4, L'-', 0x71 },+ { BOXDRAW_VERT= ICAL, > 0xb3, L'|', 0x78 },+ { BOXDRAW_DOWN_RIGHT, 0xda, L'/', = 0x6c },+ { > BOXDRAW_DOWN_LEFT, 0xbf, L'\\', 0x6b },+ { > BOXDRAW_UP_RIGHT, 0xc0, L'\\', 0x6d },+ { BOXDRAW_UP_L= EFT, > 0xd9, L'/', 0x6a },+ { BOXDRAW_VERTICAL_RIGHT, 0xc3, L'|', = 0x74 },+ { > BOXDRAW_VERTICAL_LEFT, 0xb4, L'|', 0x75 },+ { > BOXDRAW_DOWN_HORIZONTAL, 0xc2, L'+', 0x77 },+ { > BOXDRAW_UP_HORIZONTAL, 0xc1, L'+', 0x76 },+ { > BOXDRAW_VERTICAL_HORIZONTAL, 0xc5, L'+', 0x6e },+ { > BOXDRAW_DOUBLE_HORIZONTAL, 0xcd, L'-', 0x71 },+ { > BOXDRAW_DOUBLE_VERTICAL, 0xba, L'|', 0x78 },+ { > BOXDRAW_DOWN_RIGHT_DOUBLE, 0xd5, L'/', 0x6c },+ { > BOXDRAW_DOWN_DOUBLE_RIGHT, 0xd6, L'/', 0x6c },+ { > BOXDRAW_DOUBLE_DOWN_RIGHT, 0xc9, L'/', 0x6c },+ { > BOXDRAW_DOWN_LEFT_DOUBLE, 0xb8, L'\\', 0x6b },+ { > BOXDRAW_DOWN_DOUBLE_LEFT, 0xb7, L'\\', 0x6b },+ { > BOXDRAW_DOUBLE_DOWN_LEFT, 0xbb, L'\\', 0x6b },+ { > BOXDRAW_UP_RIGHT_DOUBLE, 0xd4, L'\\', 0x6d },+ { > BOXDRAW_UP_DOUBLE_RIGHT, 0xd3, L'\\', 0x6d },+ { > BOXDRAW_DOUBLE_UP_RIGHT, 0xc8, L'\\', 0x6d },+ { > BOXDRAW_UP_LEFT_DOUBLE, 0xbe, L'/', 0x6a },+ { > BOXDRAW_UP_DOUBLE_LEFT, 0xbd, L'/', 0x6a },+ { > BOXDRAW_DOUBLE_UP_LEFT, 0xbc, L'/', 0x6a },+ { > BOXDRAW_VERTICAL_RIGHT_DOUBLE, 0xc6, L'|', 0x74 },+ { > BOXDRAW_VERTICAL_DOUBLE_RIGHT, 0xc7, L'|', 0x74 },+ { > BOXDRAW_DOUBLE_VERTICAL_RIGHT, 0xcc, L'|', 0x74 },+ { > BOXDRAW_VERTICAL_LEFT_DOUBLE, 0xb5, L'|', 0x75 },+ { > BOXDRAW_VERTICAL_DOUBLE_LEFT, 0xb6, L'|', 0x75 },+ { > BOXDRAW_DOUBLE_VERTICAL_LEFT, 0xb9, L'|', 0x75 },+ { > BOXDRAW_DOWN_HORIZONTAL_DOUBLE, 0xd1, L'+', 0x77 },+ { > BOXDRAW_DOWN_DOUBLE_HORIZONTAL, 0xd2, L'+', 0x77 },+ { > BOXDRAW_DOUBLE_DOWN_HORIZONTAL, 0xcb, L'+', 0x77 },+ { > BOXDRAW_UP_HORIZONTAL_DOUBLE, 0xcf, L'+', 0x76 },+ { > BOXDRAW_UP_DOUBLE_HORIZONTAL, 0xd0, L'+', 0x76 },+ { > BOXDRAW_DOUBLE_UP_HORIZONTAL, 0xca, L'+', 0x76 },+ { > BOXDRAW_VERTICAL_HORIZONTAL_DOUBLE, 0xd8, L'+', 0x6e },+ { > BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL, 0xd7, L'+', 0x6e },+ { > BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL, 0xce, L'+', 0x6e }, - { > BLOCKELEMENT_FULL_BLOCK, 0xdb, L'*' },- { > BLOCKELEMENT_LIGHT_SHADE, 0xb0, L'+' },+ { > BLOCKELEMENT_FULL_BLOCK, 0xdb, L'*', 0x61 },+ { > BLOCKELEMENT_LIGHT_SHADE, 0xb0, L'+', 0x61 }, - { > GEOMETRICSHAPE_UP_TRIANGLE, '^', L'^' },- { > GEOMETRICSHAPE_RIGHT_TRIANGLE, '>', L'>' },- { > GEOMETRICSHAPE_DOWN_TRIANGLE, 'v', L'v' },- { > GEOMETRICSHAPE_LEFT_TRIANGLE, '<', L'<' },+ { > GEOMETRICSHAPE_UP_TRIANGLE, '^', L'^', L'^' },+ { > GEOMETRICSHAPE_RIGHT_TRIANGLE, '>', L'>', L'>' },+ { > GEOMETRICSHAPE_DOWN_TRIANGLE, 'v', L'v', L'v' },+ { > GEOMETRICSHAPE_LEFT_TRIANGLE, '<', L'<', L'<' }, - { ARROW_LEFT, > '<', L'<' },- { ARROW_UP, '^', L'^' },- { ARR= OW_RIGHT, > '>', L'>' },- { ARROW_DOWN, 'v', L'v' },-- { 0x= 0000, > 0x00, L'\0' }+ { ARROW_LEFT, '<', L'<', L'<' }= ,+ { ARROW_UP, > '^', L'^', L'^' },+ { ARROW_RIGHT, '>', L'>', = L'>' },+ { > ARROW_DOWN, 'v', L'v', L'v' }, }; CHAR16 mSetM= odeString[] > =3D { ESC, '[', '=3D', '3', 'h', 0 };@@ -80,6 +78,8 @@ CHAR16 > mSetCursorPositionString[] =3D { ESC, '[', '0', '0', ';', '0', '0', 'H',= 0 > CHAR16 mCursorForwardString[] =3D { ESC, '[', '0', '0', 'C', 0 }; C= HAR16 > mCursorBackwardString[] =3D { ESC, '[', '0', '0', 'D', 0 }; +CHAR8 > SetDecModeString[] =3D {ESC, 0x28, 0x30};+CHAR8 ExitDecModeStri= ng[] > =3D {ESC, 0x28, 0x42}; // // Body of the ConOut functions //@@ -183,16 +1= 83,19 > @@ TerminalConOutOutputString ( > EFI_STATUS Status; UINT8 Vali= dBytes; CHAR8 > CrLfStr[2];+ CHAR8 DecChar;+ UINTN > ModeSwitchLength; // // flag used to indicate whether condition happ= ens > which will cause // return EFI_WARN_UNKNOWN_GLYPH // BOOLEAN > Warning; - ValidBytes =3D 0;- Warning =3D FALSE;- AsciiChar =3D= 0;-+ ValidBytes > =3D 0;+ Warning =3D FALSE;+ AsciiChar =3D 0;+ DecChar = =3D 0;+ > ModeSwitchLength =3D LENGTH_DEC_ESCAPE; // // get Terminal device da= ta > structure pointer. //@@ -217,17 +220,136 @@ TerminalConOutOutputString > ( > for (; *WString !=3D CHAR_NULL; WString++) { switch (TerminalDevi= ce- > >TerminalType) {- case TerminalTypePcAnsi:- case TerminalTypeVt100= :- > case TerminalTypeVt100Plus:- case TerminalTypeTtyTerm:- case > TerminalTypeLinux:+ if (!TerminalIsValidTextGraphics (*WString, > &GraphicChar, &AsciiChar, NULL)) {+ //+ // If it's not a gr= aphic > character convert Unicode to ASCII.+ //+ GraphicChar =3D > (CHAR8)*WString;++ if (!(TerminalIsValidAscii (GraphicChar) || > TerminalIsValidEfiCntlChar (GraphicChar))) {+ //+ // wh= en this driver > use the OutputString to output control string,+ // TerminalDevic= e- > >OutputEscChar is set to let the Esc char+ // to be output to th= e terminal > emulation software.+ //+ if ((GraphicChar =3D=3D 27) && > TerminalDevice->OutputEscChar) {+ GraphicChar =3D 27;+ = } else {+ > GraphicChar =3D '?';+ Warning =3D TRUE;+ }+ = }++ AsciiChar =3D > GraphicChar;+ }+ Length =3D 1;+ Status =3D TerminalDevice-= >SerialIo- > >Write (+ TerminalDevice->Serial= Io,+ > &Length,+ &GraphicChar+ = );++ if > (EFI_ERROR (Status)) {+ goto OutputError;+ }++ break; = case > TerminalTypeXtermR6:- case TerminalTypeVt400: case > TerminalTypeSCO:+ if (TerminalIsValidTextGraphics (*WString, NULL, > NULL, &DecChar) && !TerminalIsValidAscii (*WString)) {+ //Box gr= aphics > are split into 2 types simple and advanced+ //simple are drawn w= ith dec > special graphics+ //advanced are drawn with utf8+ //Thi= s checks for > simple because they have a lower value than the advanced+ if(*WS= tring > < BOXDRAW_DOUBLE_HORIZONTAL) {+ if (!TerminalDevice- > >DecSpecialGraphicsMode) {+ ValidBytes =3D 0;+ > ModeSwitchLength =3D LENGTH_DEC_ESCAPE;+ Status =3D > TerminalDevice->SerialIo->Write (+ = TerminalDevice- > >SerialIo,+ &ModeSwitch= Length,+ > (UINT8 *)SetDecModeString+ );+ = TerminalDevice- > >DecSpecialGraphicsMode =3D TRUE;+ } - if (!TerminalIsValidTe= xtGraphics > (*WString, &GraphicChar, &AsciiChar)) {+ GraphicChar =3D DecChar;+ > Length =3D 1;+ } else {+ if (TerminalDevice- > >DecSpecialGraphicsMode) {+ ModeSwitchLength =3D > LENGTH_DEC_ESCAPE;+ Status =3D TerminalDevice->SerialIo->Wri= te (+ > TerminalDevice->SerialIo,+ = &ModeSwitchLength,+ > (UINT8 *)ExitDecModeString+ = );+ if > (EFI_ERROR (Status)) {+ goto OutputError;+ = }++ > TerminalDevice->DecSpecialGraphicsMode =3D FALSE;+ }++ > UnicodeToUtf8 (*WString, &Utf8Char, &ValidBytes);+ Length =3D > ValidBytes;+ }+ } else {+ if (TerminalDevice- > >DecSpecialGraphicsMode) {+ Status =3D TerminalDevice->SerialIo-= >Write > (+ TerminalDevice->SerialIo,+ > &ModeSwitchLength,+ (UINT8 *)Exi= tDecModeString+ > );+ if (EFI_ERROR (Status)) {+ goto OutputError;+ = }++ > TerminalDevice->DecSpecialGraphicsMode =3D FALSE;+ }++ > GraphicChar =3D (CHAR8)*WString;++ if (!(TerminalIsValidAscii > (GraphicChar) || TerminalIsValidEfiCntlChar (GraphicChar))) {+ /= /+ > // when this driver use the OutputString to output control string,+ = // > TerminalDevice->OutputEscChar is set to let the Esc char+ // to = be > output to the terminal emulation software.+ //+ if ((= GraphicChar > =3D=3D 27) && TerminalDevice->OutputEscChar) {+ GraphicChar = =3D 27;+ > Length =3D 1;+ } else {+ UnicodeToUtf8 (*WString, &Ut= f8Char, > &ValidBytes);+ Length =3D ValidBytes;+ }+ } = else {+ Length =3D > 1;+ }+ }++ if (ValidBytes) {+ Status =3D Terminal= Device->SerialIo- > >Write (+ TerminalDevice->SerialIo= ,+ > &Length,+ (UINT8 *)&Utf8Cha= r+ > );+ ValidBytes =3D 0;+ } else {+ Status =3D Terminal= Device->SerialIo- > >Write (+ TerminalDevice->SerialIo,+ > &Length,+ &GraphicChar+ = );+ }+ if > (EFI_ERROR (Status)) {+ goto OutputError;+ }++ break;+ = case > TerminalTypeVt100:+ case TerminalTypeTtyTerm:+ if > (!TerminalIsValidTextGraphics (*WString, &GraphicChar, &AsciiChar, NULL))= { > // // If it's not a graphic character convert Unicode to ASCII. = //@@ - > 248,12 +370,9 @@ TerminalConOutOutputString ( > } AsciiChar =3D GraphicChar;- } - if (Termin= alDevice- > >TerminalType !=3D TerminalTypePcAnsi) {- GraphicChar =3D AsciiCha= r;- }+ > GraphicChar =3D AsciiChar; Length =3D 1; @@ -267,8 +386,67 @@ > TerminalConOutOutputString ( > goto OutputError; } - break;+ break;+ case > TerminalTypeVt100Plus:+ case TerminalTypeVt400:+ Length =3D 1;+= if > (TerminalIsValidTextGraphics (*WString, NULL, NULL, &DecChar)) {+ = if > (!TerminalDevice->DecSpecialGraphicsMode) {+ ModeSwitchLength = =3D > LENGTH_DEC_ESCAPE;+ Status =3D TerminalDevice->SerialIo->Write= (+ > TerminalDevice->SerialIo,+ = &ModeSwitchLength,+ > (UINT8 *)SetDecModeString+ );+ = TerminalDevice- > >DecSpecialGraphicsMode =3D TRUE;+ } + GraphicChar =3D DecC= har;+ } > else {+ if (TerminalDevice->DecSpecialGraphicsMode) {+ > ModeSwitchLength =3D LENGTH_DEC_ESCAPE;+ Status =3D TerminalDe= vice- > >SerialIo->Write (+ Termi= nalDevice->SerialIo,+ > &ModeSwitchLength,+ (UINT= 8 > *)ExitDecModeString+ );++ = if (EFI_ERROR (Status)) > {+ goto OutputError;+ }++ TerminalDevice- > >DecSpecialGraphicsMode =3D FALSE;+ }++ GraphicChar =3D > (CHAR8)*WString;++ if (!(TerminalIsValidAscii (GraphicChar) || > TerminalIsValidEfiCntlChar (GraphicChar))) {+ //+ // wh= en this driver > use the OutputString to output control string,+ // TerminalDevic= e- > >OutputEscChar is set to let the Esc char+ // to be output to th= e terminal > emulation software.+ //+ if ((GraphicChar =3D=3D 27) && > TerminalDevice->OutputEscChar) {+ GraphicChar =3D 27;+ = } else {+ > GraphicChar =3D '?';+ Warning =3D TRUE;+ }+ = }+ }++ Status =3D > TerminalDevice->SerialIo->Write (+ T= erminalDevice- > >SerialIo,+ &Length,+ = &GraphicChar+ > );++ if (EFI_ERROR (Status)) {+ goto OutputError;+ }++ = break;+ > case TerminalTypeLinux: case TerminalTypeVtUtf8: UnicodeToUtf8 > (*WString, &Utf8Char, &ValidBytes); Length =3D ValidBytes;@@ -280,8 > +458,10 @@ TerminalConOutOutputString ( > if (EFI_ERROR (Status)) { goto OutputError; }+ = break; }+ // > // Update cursor position. //@@ -875,7 +1055,8 @@ BOOLEAN > TerminalIsValidTextGraphics ( IN CHAR16 Graphic, OUT CHAR8 *PcAn= si, > OPTIONAL- OUT CHAR8 *Ascii OPTIONAL+ OUT CHAR8 *Ascii, OPTIONAL+ > OUT CHAR8 *DecSpecialGraphics OPTIONAL ) { UNICODE_TO_CHAR > *Table;@@ -897,6 +1078,9 @@ TerminalIsValidTextGraphics ( > if (Ascii !=3D NULL) { *Ascii =3D Table->Ascii; }+ = if (DecSpecialGraphics > !=3D NULL){+ *DecSpecialGraphics =3D Table->DecSpecialGraphics;+ = } > return TRUE; }-- > 2.32.0 >=20 >=20 >=20 > -=3D-=3D-=3D-=3D-=3D-=3D > Groups.io Links: You receive all messages sent to this group. > View/Reply Online (#78390): https://edk2.groups.io/g/devel/message/78390 > Mute This Topic: https://groups.io/mt/84545877/1767664 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub > [nathaniel.l.desimone@intel.com] -=3D-=3D-=3D-=3D-=3D-=3D >=20