Skip to content

Commit

Permalink
LCI v1.14: transformational phases
Browse files Browse the repository at this point in the history
git-svn-id: https://slps.svn.sourceforge.net/svnroot/slps@527 ab42f6e0-554d-0410-b580-99e487e6eeb2
  • Loading branch information
grammarware committed Apr 2, 2009
1 parent e99a046 commit fc81622
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions topics/convergence/lci/lci.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@

# A global flag, if set, LCI will exit with a non-zero status
problem = False

# output streams redirected to null
shutup = ' 1> /dev/null 2> /dev/null'
# transformation type per action: postextraction, synchronization, etc
ttype = {}
orderedsrc = []
shortcuts = {}
actions = []
Expand Down Expand Up @@ -53,11 +55,11 @@ def readxmlconfig (cfg):
for xmlnode in config.findall('//shortcut'):
shortcuts[xmlnode.findtext('name')]=expandxml(xmlnode.findall('expansion')[0],{})
# actions
for xmlnode in config.findall('//target/branch/perform'):
for xmlnode in config.findall('//target/branch/*/perform'):
if xmlnode.text not in actions:
actions.append(xmlnode.text)
# automated actions
for xmlnode in config.findall('//target/branch/automated'):
for xmlnode in config.findall('//target/branch/*/automated'):
if xmlnode.findtext('result') not in actions:
actions.append(xmlnode.findtext('result'))
autoactions[xmlnode.findtext('result')]=xmlnode.findtext('method')
Expand Down Expand Up @@ -85,12 +87,19 @@ def readxmlconfig (cfg):
name = xmlnode.findtext('name')
targets[name]= [[],'']
for br in xmlnode.findall('branch'):
branch = [br.findtext('input')]
for p in br.findall('*'):
if p.tag == 'perform':
branch.append(p.text)
elif p.tag == 'automated':
branch.append(p.findtext('result'))
for phase in br.findall('*'):
if phase.tag == 'input':
branch = [br.findtext('input')]
else:
for p in phase.findall('*'):
if p.tag == 'perform':
branch.append(p.text)
ttype[p.text] = phase.tag
elif p.tag == 'automated':
branch.append(p.findtext('result'))
ttype[p.findtext('result')] = phase.tag
else:
print '[WARN] Unknown tag skipped:',p.tag
targets[name][0].append(branch)
# tools
for xmlnode in config.findall('//tool'):
Expand Down Expand Up @@ -381,7 +390,7 @@ def preparebgf(cut):
ontheroll = False
else:
print '[PASS]',
print 'Generated',a+'.xbgf','from',curname+'.bgf'
print 'Generated',ttype[a],a+'.xbgf','from',curname+'.bgf'
if ontheroll:
run = tools['transformation']+' xbgf/'+a+'.xbgf bgf/'+curname+'.bgf bgf/'+curname+'.'+stripSelector2(a)+'.bgf'
logwrite(run)
Expand All @@ -408,7 +417,7 @@ def preparebgf(cut):
ontheroll = False
else:
print '[PASS]',
print 'Applied',a+'.xbgf','to',curname+'.bgf'
print 'Applied',ttype[a],a+'.xbgf','to',curname+'.bgf'
else:
failedarc.append([curname,a])
failednode.append(cut[0]+"'"*(curname.count('.')+1))
Expand Down Expand Up @@ -637,7 +646,7 @@ def checkconsistency():
sysexit(18)

if __name__ == "__main__":
print 'Language Covergence Infrastructure v1.13'
print 'Language Covergence Infrastructure v1.14'
if len(sys.argv) == 3:
log = open(sys.argv[1].split('.')[0]+'.log','w')
readxmlconfig(sys.argv[1])
Expand Down

0 comments on commit fc81622

Please sign in to comment.