From 2fceb77c47a168df38ca7f3b6b57ff9acc71679b Mon Sep 17 00:00:00 2001 From: Greg Watson Date: Thu, 10 Jul 2003 20:55:09 +0000 Subject: new print statement git-svn-id: svn://svn.coreboot.org/coreboot/trunk@939 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- util/newconfig/config.g | 53 +++++++++++++++++++------------------------------ 1 file changed, 20 insertions(+), 33 deletions(-) diff --git a/util/newconfig/config.g b/util/newconfig/config.g index b5effff06f..7b7b89ce25 100644 --- a/util/newconfig/config.g +++ b/util/newconfig/config.g @@ -11,19 +11,16 @@ arch = '' ldscriptbase = '' payloadfile = '' -makeoptions = {} -makeexpressions = [] - # Key is the rule name. Value is a mkrule object. makebaserules = {} # List of targets in the order defined by makerule commands. -makerule_targets = {} +#makerule_targets = {} treetop = '' target_dir = '' -sources = {} +#sources = {} objectrules = {} # make these a hash so they will be unique. driverrules = {} @@ -121,11 +118,7 @@ class option: def setvalue(self, value, loc): if (self.set): - print "Option %s: " % 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) + fatal("Error: option %s already set" % self.name) self.set = 1 self.value = value self.defined = 1 @@ -148,18 +141,7 @@ class option: def setdefault(self, value, loc): if (self.default): - print "%s: " % 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 + fatal("Error: default value for %s already set" % self.name) self.value = value self.defined = 1 self.default = 1 @@ -652,10 +634,10 @@ def dodir(path, file): curdir = dirstack.pop() def lookup(name): - global curpart - v = getoption(name, curpart) - exitiferrors() - return v + global curpart + v = getoption(name, curpart) + exitiferrors() + return v def ternary(val, yes, no): if (debug): @@ -1101,7 +1083,7 @@ parser Config: | dir<> {{ return dir}} | ldscript<> {{ return ldscript}} | payload<> {{ return payload}} - | pprint<> {{ return pprint}} + | prtstmt<> {{ return prtstmt}} # ENTRY for parsing Config.lb file rule cfgfile: (uses<<1>>)* (stmt<<1>>)* @@ -1123,13 +1105,18 @@ parser Config: rule opstmt<>: option<> | opif<> - | pprint<> + | prtstmt<> + + rule prtval: expr {{ return str(expr) }} + | STR {{ return STR }} + + rule prtlist: prtval {{ el = "%(" + prtval }} + ( "," prtval {{ el = el + "," + prtval }} + )* {{ return el + ")" }} - # print clashes with a python keyword - rule pprint<>: PRINT - ( STR {{ if (C): print "%s" % dequote(STR) }} - | ID {{ if (C): print "%s" % getformated(ID, curpart) }} - ) + rule prtstmt<>: PRINT STR {{ val = STR }} + [ "," prtlist {{ val = val + prtlist }} + ] {{ if (C): print eval(val) }} # ENTRY for parsing a delayed value rule delexpr: "{" expr "}" {{ return expr }} -- cgit v1.2.3