BaseTools: Update Expression.py for VOID* to support L'a' and 'a'
Original VOID* type support L"string" and "string" format, now we also add support for single quote string that without null terminator. Type VOID* support L'a' and 'a', the value transfer to c style value. L'a' --> {0x61, 0x00} L'ab' --> {0x61, 0x00, 0x62, 0x00} 'a' --> {0x61} 'ab' --> {0x61, 0x62} when the value is L'' or '' that not include any character, tool will report error. Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
committed by
Yonghong Zhu
parent
bee0f2f167
commit
0e6b86731e
@ -1572,6 +1572,8 @@ def ParseFieldValue (Value):
|
||||
if Value.startswith("L'") and Value.endswith("'"):
|
||||
# Unicode Character Constant
|
||||
List = list(Value[2:-1])
|
||||
if len(List) == 0:
|
||||
raise BadExpression('Length %s is %s' % (Value, len(List)))
|
||||
List.reverse()
|
||||
Value = 0
|
||||
for Char in List:
|
||||
@ -1580,6 +1582,8 @@ def ParseFieldValue (Value):
|
||||
if Value.startswith("'") and Value.endswith("'"):
|
||||
# Character constant
|
||||
List = list(Value[1:-1])
|
||||
if len(List) == 0:
|
||||
raise BadExpression('Length %s is %s' % (Value, len(List)))
|
||||
List.reverse()
|
||||
Value = 0
|
||||
for Char in List:
|
||||
|
Reference in New Issue
Block a user