## @file\r
# Common routines used by all tools\r
#\r
-# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r
if Value.startswith("L'") and Value.endswith("'"):\r
# Unicode Character Constant\r
List = list(Value[2:-1])\r
+ if len(List) == 0:\r
+ raise BadExpression('Length %s is %s' % (Value, len(List)))\r
List.reverse()\r
Value = 0\r
for Char in List:\r
if Value.startswith("'") and Value.endswith("'"):\r
# Character constant\r
List = list(Value[1:-1])\r
+ if len(List) == 0:\r
+ raise BadExpression('Length %s is %s' % (Value, len(List)))\r
List.reverse()\r
Value = 0\r
for Char in List:\r
if Type == "VOID*":\r
ValueRe = re.compile(r'\s*L?\".*\"\s*$')\r
if not (((Value.startswith('L"') or Value.startswith('"')) and Value.endswith('"'))\r
- or (Value.startswith('{') and Value.endswith('}'))\r
+ or (Value.startswith('{') and Value.endswith('}')) or (Value.startswith("L'") or Value.startswith("'") and Value.endswith("'"))\r
):\r
return False, "Invalid value [%s] of type [%s]; must be in the form of {...} for array"\\r
- ", or \"...\" for string, or L\"...\" for unicode string" % (Value, Type)\r
+ ", \"...\" or \'...\' for string, L\"...\" or L\'...\' for unicode string" % (Value, Type)\r
elif ValueRe.match(Value):\r
# Check the chars in UnicodeString or CString is printable\r
if Value.startswith("L"):\r
)\r
\r
def BuildOptionPcdValueFormat(TokenSpaceGuidCName, TokenCName, PcdDatumType, Value):\r
- if PcdDatumType == 'VOID*':\r
- if Value.startswith('L'):\r
+ if PcdDatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64,'BOOLEAN']:\r
+ if Value.startswith('L') or Value.startswith('"'):\r
if not Value[1]:\r
EdkLogger.error("build", FORMAT_INVALID, 'For Void* type PCD, when specify the Value in the command line, please use the following format: "string", L"string", H"{...}"')\r
- Value = Value[0] + '"' + Value[1:] + '"'\r
+ Value = Value\r
elif Value.startswith('H'):\r
if not Value[1]:\r
EdkLogger.error("build", FORMAT_INVALID, 'For Void* type PCD, when specify the Value in the command line, please use the following format: "string", L"string", H"{...}"')\r