1.1 --- a/encoders.py Thu Jul 05 16:01:33 2018 +0200
1.2 +++ b/encoders.py Thu Jul 05 19:34:04 2018 +0200
1.3 @@ -78,6 +78,13 @@
1.4
1.5 return "%s:%s:%s:%d" % (t.path, t.name or "{}", t.attrnames or "{}", t.access_number)
1.6
1.7 +def decode_access_location(s):
1.8 +
1.9 + "Decode the access location 's'."
1.10 +
1.11 + path, name, attrnames, access_number = s.split(":")
1.12 + return path, name, attrnames, access_number
1.13 +
1.14 def encode_alias_location(t, invocation=False):
1.15
1.16 "Encode the alias location 't'."
2.1 --- a/tools/showalias.py Thu Jul 05 16:01:33 2018 +0200
2.2 +++ b/tools/showalias.py Thu Jul 05 19:34:04 2018 +0200
2.3 @@ -1,6 +1,6 @@
2.4 #!/usr/bin/env python
2.5
2.6 -from os.path import abspath, split
2.7 +from os.path import abspath, exists, join, split
2.8 import sys
2.9
2.10 # Find the modules.
2.11 @@ -15,12 +15,18 @@
2.12 from encoders import decode_alias_location
2.13
2.14 if len(sys.argv) < 3:
2.15 - print >>sys.stderr, "Usage: %s <filename> <alias>" % sys.argv[0]
2.16 + print >>sys.stderr, "Usage: %s <directory> <alias>" % sys.argv[0]
2.17 sys.exit(1)
2.18
2.19 -filename = sys.argv[1]
2.20 +dirname = sys.argv[1]
2.21 alias = sys.argv[2]
2.22
2.23 +filename = join(dirname, "_deduced", "aliases")
2.24 +
2.25 +if not exists(filename):
2.26 + print >>sys.stderr, "Directory %s does not provide file %s." % (dirname, filename)
2.27 + sys.exit(1)
2.28 +
2.29 f = open(filename)
2.30 try:
2.31 for line in f.xreadlines():
3.1 --- a/tools/showplan.py Thu Jul 05 16:01:33 2018 +0200
3.2 +++ b/tools/showplan.py Thu Jul 05 19:34:04 2018 +0200
3.3 @@ -1,14 +1,32 @@
3.4 #!/usr/bin/env python
3.5
3.6 +from os.path import abspath, exists, join, split
3.7 import sys
3.8
3.9 +# Find the modules.
3.10 +
3.11 +try:
3.12 + import encoders
3.13 +except ImportError:
3.14 + parent = abspath(split(split(__file__)[0])[0])
3.15 + if split(parent)[1] == "Lichen":
3.16 + sys.path.append(parent)
3.17 +
3.18 +from encoders import decode_access_location
3.19 +
3.20 if len(sys.argv) < 3:
3.21 - print >>sys.stderr, "Usage: %s <filename> <access>" % sys.argv[0]
3.22 + print >>sys.stderr, "Usage: %s <directory> <access>" % sys.argv[0]
3.23 sys.exit(1)
3.24
3.25 -filename = sys.argv[1]
3.26 +dirname = sys.argv[1]
3.27 access = sys.argv[2]
3.28
3.29 +filename = join(dirname, "_deduced", "attribute_plans")
3.30 +
3.31 +if not exists(filename):
3.32 + print >>sys.stderr, "Directory %s does not provide file %s." % (dirname, filename)
3.33 + sys.exit(1)
3.34 +
3.35 f = open(filename)
3.36 try:
3.37 for line in f.xreadlines():
3.38 @@ -17,17 +35,21 @@
3.39 continue
3.40
3.41 location, name, test, test_type, base, traversed, traversal_modes, \
3.42 - attrnames, context, context_test, first_method, final_method, attr, \
3.43 - accessor_kinds = columns
3.44 + traversal_attrnames, context, context_test, \
3.45 + first_method, final_method, attr, accessor_kinds = columns
3.46 +
3.47 + path, _name, attrnames, access_number = decode_access_location(location)
3.48
3.49 print "Location:", location
3.50 print "Name:", name
3.51 + print "Attribute names:", attrnames
3.52 + print "Access number:", access_number
3.53 print "Test:", test
3.54 print "Test type:", test_type
3.55 print "Base:", base
3.56 print "Traversed:", traversed
3.57 print "Traversal modes:", traversal_modes
3.58 - print "Attribute names:", attrnames
3.59 + print "Traversed attributes:", traversal_attrnames
3.60 print "Context:", context
3.61 print "Context test:", context_test
3.62 print "First method:", first_method