Navigation Menu

Skip to content

Commit

Permalink
more correct metrics, more metrics in overview
Browse files Browse the repository at this point in the history
git-svn-id: https://slps.svn.sourceforge.net/svnroot/slps@621 ab42f6e0-554d-0410-b580-99e487e6eeb2
  • Loading branch information
grammarware committed May 3, 2009
1 parent 9689bfe commit 5e410ad
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 27 deletions.
2 changes: 1 addition & 1 deletion shared/python/lci.py
Expand Up @@ -545,7 +545,7 @@ def transformationChain(cut,target):
print '[PASS]',
else:
print '[FAIL]',
print 'Postextraction and synchronyzation finished for target',target+'.'
print 'Postextraction and synchronization finished for target',target+'.'
# same for transformation
ontheroll,current = runTransforms(cut,current,('refactoring','extension','correction','relaxation'))
# end of branch
Expand Down
12 changes: 11 additions & 1 deletion shared/python/slpsXPath.py
Expand Up @@ -23,7 +23,7 @@
#incdecxbgf = ('add', 'narrow', 'remove','unite', 'widen', 'rassoc', 'lassoc')
messyxbgf = ('permute', 'dump','project','inject','concretize','abstractize')

rkeys = ('LOC','NOI','NOX','NI~','NI+','NI!','SGO','COR','NI^','SID','SRE')
rkeys = ('LOC','NOI','NOX','NI~','NI+','NI!','SGO','COR','NI^','SID','SRE','EKB','EPX','EIC','FRE','FEX','FCO','EAR','FIN')

def runxpath(filename,xpathexpr):
os.system('xpath '+filename+' "'+xpathexpr+'" 1>TMP-res 2>/dev/null')
Expand Down Expand Up @@ -95,3 +95,13 @@ def noi(filename):
c = ''.join(f.readlines()).count('<!--')
f.close()
return c

def countSemanticPreserving(xbgf,xbgfFile):
return noni(xbgf,safexbgf) + nosi(xbgfFile,'BREFACTOR') + noPartiallySafe(xbgf)

def countSemanticIncDec(xbgf,xbgfFile):
return noni(xbgf,incdecxbgf) + nosi(xbgfFile,'GENERALITY') - nosi(xbgfFile,'NOTINCDEC')

def countSemanticRevising(xbgf,xbgfFile):
return noni(xbgf,messyxbgf) + nosi(xbgfFile,'REVISE') + noPartiallyUnsafe(xbgf)

16 changes: 7 additions & 9 deletions shared/python/xbgf_check.py
Expand Up @@ -18,14 +18,9 @@
xbgfFile = sys.argv[1]
xbgf = ET.parse(xbgfFile)
print "%30s" % xbgfFile.split('.')[0]+':',
cx = slpsXPath.noni(xbgf,slpsXPath.safexbgf) + \
slpsXPath.nosi(xbgfFile,'BREFACTOR') + \
slpsXPath.noPartiallySafe(xbgf), \
slpsXPath.noni(xbgf,slpsXPath.incdecxbgf) + \
slpsXPath.nosi(xbgfFile,'GENERALITY'), \
slpsXPath.noni(xbgf,slpsXPath.messyxbgf) + \
slpsXPath.nosi(xbgfFile,'REVISE') + \
slpsXPath.noPartiallyUnsafe(xbgf)
cx = slpsXPath.countSemanticPreserving(xbgf,xbgfFile), \
slpsXPath.countSemanticIncDec(xbgf,xbgfFile), \
slpsXPath.countSemanticRevising(xbgf,xbgfFile)
early = slpsXPath.nosi(xbgfFile,'KNOWNBUG'), slpsXPath.nosi(xbgfFile,'POSTEXTR'), slpsXPath.nosi(xbgfFile,'INITCORR')
final = slpsXPath.nosi(xbgfFile,'EXTENSION'), slpsXPath.nosi(xbgfFile,'RELAXATION'), slpsXPath.nosi(xbgfFile,'CORRECTION')
realSum = slpsXPath.notr(xbgf)
Expand All @@ -49,7 +44,10 @@
print 'C'+`final[2]`,
print '}',
if sum(early)+sum(final) != cx[1]+cx[2]:
print 'TAGERROR'
if sum(cx) != realSum:
print 'TAGERROR','ERROR'
else:
print 'TAGERROR'
sys.exit(1)
if sum(cx) != realSum:
print 'ERROR'
Expand Down
45 changes: 29 additions & 16 deletions shared/python/xbgf_overview.py
Expand Up @@ -50,23 +50,27 @@ def report(keys,key,note):
for y in slpsXPath.rkeys:
results[y][x] = 0
for y in targets[x]:
xbgf = ET.parse(path+y+'.xbgf')
results['LOC'][x] += slpsXPath.loc(path+y+'.xbgf')
results['NOI'][x] += slpsXPath.nosi(path+y+'.xbgf','ISSUE')
results['NI~'][x] += slpsXPath.nosi(path+y+'.xbgf','ISSUE REFACTOR')
results['NI+'][x] += slpsXPath.nosi(path+y+'.xbgf','EXTEND')
results['NI!'][x] += slpsXPath.nosi(path+y+'.xbgf','CORRECT')
results['NI^'][x] += slpsXPath.nosi(path+y+'.xbgf','PERMISSIVENESS')
results['COR'][x] += slpsXPath.nosi(path+y+'.xbgf','EXTRACTERROR')
results['SGO'][x] += slpsXPath.noni(xbgf,slpsXPath.safexbgf)+\
slpsXPath.nosi(path+y+'.xbgf','BREFACTOR')+\
slpsXPath.noPartiallySafe(xbgf)
results['SID'][x] += slpsXPath.noni(xbgf,slpsXPath.incdecxbgf)+\
slpsXPath.nosi(path+y+'.xbgf','GENERALITY')
results['SRE'][x] += slpsXPath.noni(xbgf,slpsXPath.messyxbgf)+\
slpsXPath.nosi(path+y+'.xbgf','REVISE')+\
slpsXPath.noPartiallyUnsafe(xbgf)
xbgfFile = path+y+'.xbgf'
xbgf = ET.parse(xbgfFile)
results['LOC'][x] += slpsXPath.loc(xbgfFile)
results['NOI'][x] += slpsXPath.nosi(xbgfFile,'ISSUE')
results['NI~'][x] += slpsXPath.nosi(xbgfFile,'ISSUE REFACTOR')
results['NI+'][x] += slpsXPath.nosi(xbgfFile,'EXTEND')
results['NI!'][x] += slpsXPath.nosi(xbgfFile,'CORRECT')
results['NI^'][x] += slpsXPath.nosi(xbgfFile,'PERMISSIVENESS')
results['COR'][x] += slpsXPath.nosi(xbgfFile,'EXTRACTERROR')
results['SGO'][x] += slpsXPath.countSemanticPreserving(xbgf,xbgfFile)
results['SID'][x] += slpsXPath.countSemanticIncDec(xbgf,xbgfFile)
results['SRE'][x] += slpsXPath.countSemanticRevising(xbgf,xbgfFile)
results['NOX'][x] += slpsXPath.notr(xbgf)
results['EKB'][x] += slpsXPath.nosi(xbgfFile,'KNOWNBUG')
results['EPX'][x] += slpsXPath.nosi(xbgfFile,'POSTEXTR')
results['EIC'][x] += slpsXPath.nosi(xbgfFile,'INITCORR')
results['EAR'][x] += slpsXPath.nosi(xbgfFile,'KNOWNBUG')+slpsXPath.nosi(xbgfFile,'POSTEXTR')+slpsXPath.nosi(xbgfFile,'INITCORR')
results['FEX'][x] += slpsXPath.nosi(xbgfFile,'EXTENSION')
results['FRE'][x] += slpsXPath.nosi(xbgfFile,'RELAXATION')
results['FCO'][x] += slpsXPath.nosi(xbgfFile,'CORRECTION')
results['FIN'][x] += slpsXPath.nosi(xbgfFile,'EXTENSION')+slpsXPath.nosi(xbgfFile,'RELAXATION')+slpsXPath.nosi(xbgfFile,'CORRECTION')
for z in names:
results[z][x] += len(xbgf.findall('/'+slpsns.xbgf_(z)))
for x in names[:]:
Expand Down Expand Up @@ -105,6 +109,15 @@ def report(keys,key,note):
report(sorted,'NI+','\\'+lcfname+'IssuesExtend')
report(sorted,'NI^','\\'+lcfname+'IssuesPermit')
# report(sorted,'NI~','\\'+lcfname+'IssuesRefactor')
report(sorted,'EAR','\\'+lcfname+'Early')
report(sorted,'EKB','\\'+lcfname+'EarlyKnownBugs')
report(sorted,'EPX','\\'+lcfname+'EarlyPostExtraction')
report(sorted,'EIC','\\'+lcfname+'EarlyInitialCorrection')
print '\\hline'
report(sorted,'FIN','\\'+lcfname+'Final')
report(sorted,'FCO','\\'+lcfname+'FinalCorrection')
report(sorted,'FRE','\\'+lcfname+'FinalRelaxation')
report(sorted,'FEX','\\'+lcfname+'FinalExtension')
print '\\hline'
print '\\end{tabular}'
sys.exit(0)

0 comments on commit 5e410ad

Please sign in to comment.