InfProtocolObject.py revision 4fd606d1f5abe38e1f42c38de1d2e895166bd0f4
## @file
# This file is used to define class objects of INF file [Protocols] section.
# It will consumed by InfParser.
#
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials are licensed and made available
# under the terms and conditions of the BSD License which accompanies this
# distribution. The full text of the license may be found at
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
'''
InfProtocolObject
'''
CommentInsList = []
PreUsage = None
PreNotify = None
PreHelpText = ''
BlockFlag = -1
Count = 0
for CommentItem in CommentsList:
['PROTOCOL'],
pass
if CommentItemHelpText == None:
CommentItemHelpText = ''
BlockFlag = 4
else:
BlockFlag = 3
elif BlockFlag == -1:
BlockFlag = 4
if BlockFlag == -1:
BlockFlag = 1
elif BlockFlag == 1:
BlockFlag = 2
else:
BlockFlag = 3
elif BlockFlag == -1:
BlockFlag = 4
#
# Combine two comment line if they are generic comment
#
if BlockFlag == 4:
BlockFlag = -1
PreUsage = None
PreNotify = None
PreHelpText = ''
elif BlockFlag == 3:
#
# Add previous help string
#
#
# Add Current help string
#
BlockFlag = -1
PreUsage = None
PreNotify = None
PreHelpText = ''
else:
return InfProtocolItemObj
class InfProtocolItemCommentContent():
#
# ## SOMETIMES_CONSUMES ## HelpString
#
#
# Help String
#
self.CommentList = []
def GetUsageItem(self):
def GetHelpStringItem(self):
return self.HelpStringItem
class InfProtocolItem():
self.SupArchList = []
self.CommentList = []
def GetFeatureFlagExp(self):
return self.FeatureFlagExp
def GetSupArchList(self):
return self.SupArchList
def GetCommentList(self):
return self.CommentList
##
#
#
#
class InfProtocolObject():
#
# Macro defined in this section should be only used in this section.
#
__SupArchList = []
#
# Validate Arch
#
ArchItem = 'COMMON'
for Item in ProtocolContent:
#
# Get Comment content of this protocol
#
CommentsList = None
#
# Only CName contained
#
else:
#
# Contained CName and Feature Flag Express
# <statements> ::= <CName> ["|"
# <FeatureFlagExpress>]
# For Protocol Object
#
#
# Validate Feature Flag Express for Item[1]
#
if not FeatureFlagRtv[0]:
#
# Invalid format of Protocols statement
#
#
#
else:
#
# Determine protocol name duplicate. Follow below rule:
#
# A protocol must not be duplicated within a [Protocols] section.
# A protocol may appear in multiple architectural [Protocols]
# sections. A protocol listed in an architectural [Protocols]
# section must not be listed in the common architectural
# [Protocols] section.
#
# NOTE: This check will not report error now.
#
for ItemArch in ItemSupArchList:
for ProtocolItemObjArch in __SupArchList:
if ItemArch == ProtocolItemObjArch:
#
# ST.ERR_INF_PARSER_ITEM_DUPLICATE
#
pass
#
# ST.ERR_INF_PARSER_ITEM_DUPLICATE_COMMON
#
pass
else:
ProcotolList = []
return True
def GetProtocol(self):