paul@833 | 1 | #!/usr/bin/env python |
paul@833 | 2 | |
paul@841 | 3 | from os.path import abspath, exists, join, split |
paul@833 | 4 | import sys |
paul@833 | 5 | |
paul@841 | 6 | # Find the modules. |
paul@841 | 7 | |
paul@841 | 8 | try: |
paul@841 | 9 | import encoders |
paul@841 | 10 | except ImportError: |
paul@841 | 11 | parent = abspath(split(split(__file__)[0])[0]) |
paul@841 | 12 | if split(parent)[1] == "Lichen": |
paul@841 | 13 | sys.path.append(parent) |
paul@841 | 14 | |
paul@841 | 15 | from encoders import decode_access_location |
paul@841 | 16 | |
paul@833 | 17 | if len(sys.argv) < 3: |
paul@841 | 18 | print >>sys.stderr, "Usage: %s <directory> <access>" % sys.argv[0] |
paul@833 | 19 | sys.exit(1) |
paul@833 | 20 | |
paul@841 | 21 | dirname = sys.argv[1] |
paul@833 | 22 | access = sys.argv[2] |
paul@833 | 23 | |
paul@841 | 24 | filename = join(dirname, "_deduced", "attribute_plans") |
paul@841 | 25 | |
paul@841 | 26 | if not exists(filename): |
paul@841 | 27 | print >>sys.stderr, "Directory %s does not provide file %s." % (dirname, filename) |
paul@841 | 28 | sys.exit(1) |
paul@841 | 29 | |
paul@833 | 30 | f = open(filename) |
paul@833 | 31 | try: |
paul@833 | 32 | for line in f.xreadlines(): |
paul@833 | 33 | columns = line.rstrip().split() |
paul@833 | 34 | if not columns[0].startswith(access): |
paul@833 | 35 | continue |
paul@833 | 36 | |
paul@833 | 37 | location, name, test, test_type, base, traversed, traversal_modes, \ |
paul@841 | 38 | traversal_attrnames, context, context_test, \ |
paul@841 | 39 | first_method, final_method, attr, accessor_kinds = columns |
paul@841 | 40 | |
paul@841 | 41 | path, _name, attrnames, access_number = decode_access_location(location) |
paul@833 | 42 | |
paul@833 | 43 | print "Location:", location |
paul@833 | 44 | print "Name:", name |
paul@841 | 45 | print "Attribute names:", attrnames |
paul@841 | 46 | print "Access number:", access_number |
paul@833 | 47 | print "Test:", test |
paul@833 | 48 | print "Test type:", test_type |
paul@833 | 49 | print "Base:", base |
paul@833 | 50 | print "Traversed:", traversed |
paul@833 | 51 | print "Traversal modes:", traversal_modes |
paul@841 | 52 | print "Traversed attributes:", traversal_attrnames |
paul@833 | 53 | print "Context:", context |
paul@833 | 54 | print "Context test:", context_test |
paul@833 | 55 | print "First method:", first_method |
paul@833 | 56 | print "Final method:", final_method |
paul@833 | 57 | print "Origin/attribute:", attr |
paul@833 | 58 | print "Accessor kinds:", accessor_kinds |
paul@833 | 59 | print |
paul@833 | 60 | |
paul@833 | 61 | finally: |
paul@833 | 62 | f.close() |
paul@833 | 63 | |
paul@833 | 64 | # vim: tabstop=4 expandtab shiftwidth=4 |