new print statement

git-svn-id: svn://svn.coreboot.org/coreboot/trunk@939 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Greg Watson 2003-07-10 20:55:09 +00:00
parent 0d7f46d29e
commit 2fceb77c47
1 changed files with 20 additions and 33 deletions

View File

@ -11,19 +11,16 @@ arch = ''
ldscriptbase = '' ldscriptbase = ''
payloadfile = '' payloadfile = ''
makeoptions = {}
makeexpressions = []
# Key is the rule name. Value is a mkrule object. # Key is the rule name. Value is a mkrule object.
makebaserules = {} makebaserules = {}
# List of targets in the order defined by makerule commands. # List of targets in the order defined by makerule commands.
makerule_targets = {} #makerule_targets = {}
treetop = '' treetop = ''
target_dir = '' target_dir = ''
sources = {} #sources = {}
objectrules = {} objectrules = {}
# make these a hash so they will be unique. # make these a hash so they will be unique.
driverrules = {} driverrules = {}
@ -121,11 +118,7 @@ class option:
def setvalue(self, value, loc): def setvalue(self, value, loc):
if (self.set): if (self.set):
print "Option %s: " % self.name fatal("Error: option %s already set" % self.name)
print "Attempt to set %s at %s" % (value, loc.at())
print "Already set to %s at %s" % \
(self.value, self.loc.at())
sys.exit(1)
self.set = 1 self.set = 1
self.value = value self.value = value
self.defined = 1 self.defined = 1
@ -148,18 +141,7 @@ class option:
def setdefault(self, value, loc): def setdefault(self, value, loc):
if (self.default): if (self.default):
print "%s: " % self.name fatal("Error: default value for %s already set" % self.name)
print "Attempt to default %s at %s" % (value, loc)
print "Already defaulted to %s at %s" % \
(self.value, self.loc.at())
print "Warning only"
if (self.set):
print "%s: " % self.name
print "Attempt to default %s at %s" % (value, loc)
print "Already set to %s at %s" % \
(self.value, self.loc.at())
print "Warning only"
return
self.value = value self.value = value
self.defined = 1 self.defined = 1
self.default = 1 self.default = 1
@ -652,10 +634,10 @@ def dodir(path, file):
curdir = dirstack.pop() curdir = dirstack.pop()
def lookup(name): def lookup(name):
global curpart global curpart
v = getoption(name, curpart) v = getoption(name, curpart)
exitiferrors() exitiferrors()
return v return v
def ternary(val, yes, no): def ternary(val, yes, no):
if (debug): if (debug):
@ -1101,7 +1083,7 @@ parser Config:
| dir<<C>> {{ return dir}} | dir<<C>> {{ return dir}}
| ldscript<<C>> {{ return ldscript}} | ldscript<<C>> {{ return ldscript}}
| payload<<C>> {{ return payload}} | payload<<C>> {{ return payload}}
| pprint<<C>> {{ return pprint}} | prtstmt<<C>> {{ return prtstmt}}
# ENTRY for parsing Config.lb file # ENTRY for parsing Config.lb file
rule cfgfile: (uses<<1>>)* (stmt<<1>>)* rule cfgfile: (uses<<1>>)* (stmt<<1>>)*
@ -1123,13 +1105,18 @@ parser Config:
rule opstmt<<C>>: option<<C>> rule opstmt<<C>>: option<<C>>
| opif<<C>> | opif<<C>>
| pprint<<C>> | prtstmt<<C>>
# print clashes with a python keyword rule prtval: expr {{ return str(expr) }}
rule pprint<<C>>: PRINT | STR {{ return STR }}
( STR {{ if (C): print "%s" % dequote(STR) }}
| ID {{ if (C): print "%s" % getformated(ID, curpart) }} rule prtlist: prtval {{ el = "%(" + prtval }}
) ( "," prtval {{ el = el + "," + prtval }}
)* {{ return el + ")" }}
rule prtstmt<<C>>: PRINT STR {{ val = STR }}
[ "," prtlist {{ val = val + prtlist }}
] {{ if (C): print eval(val) }}
# ENTRY for parsing a delayed value # ENTRY for parsing a delayed value
rule delexpr: "{" expr "}" {{ return expr }} rule delexpr: "{" expr "}" {{ return expr }}