def process(mainfile): db = rnn.Database() rnn.parsefile(db, mainfile) db.prep() for file in db.files: fouts[file] = open(file.replace('/', '_') + '.h', 'w') printhead(file, db) for enum in db.enums: if not enum.inline: for val in enum.vals: printvalue(val, 0) for bitset in db.bitsets: if not bitset.inline: for bitfield in bitset.bitfields: printbitfield(bitfield, 0) for domain in db.domains: if domain.size: printdef(domain.fullname + "__SIZE", hex(domain.size), domain.file) for elem in domain.elems: printdelem(elem, 0, []) for file in fouts: fouts[file].write("\n#endif /* {} */\n".format(guard(file))) fouts[file].close() return db.estatus
dest='colors', default=colors.term) select = parser.add_mutually_exclusive_group() select.add_argument('-d', '--domain', default='NV_MMIO') select.add_argument('-e', '--enum') select.add_argument('-b', '--bitset') parser.add_argument('-w', '--write', action='store_true', default=False) parser.add_argument('-v', '--variant', nargs=2, action='append', default=[]) parser.add_argument('address', type=aint, help="Address to be looked up") parser.add_argument('value', type=aint, nargs='?', help="Value to be looked up") args = parser.parse_args() db = rnn.Database() rnn.parsefile(db, args.file) db.prep() vc = rnndec.Context(db, args.colors) if args.chipset is not None: vc.varadd('chipset', args.chipset) for varset, variant in args.variant: vc.varadd(varset, variant) if args.enum: en = db.findenum(args.enum) if not en: sys.stderr.write("Not an enum: '{}'\n".format(args.enum)) sys.exit(1) print(vc.decodeval(en, args.address, None))