3 # b43 firmware assembly code beautifier
5 # Copyright (C) 2008-2010 Michael Buesch <m@bues.ch>
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License version 3
9 # as published by the Free Software Foundation.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
26 print "b43 firmware assembly code beautifier"
28 print "Copyright (C) 2008 Michael Buesch <m@bues.ch>"
29 print "Licensed under the GNU/GPL version 3"
31 print "Usage: b43-beautifier [OPTIONS]"
33 print "-h|--help Print this help text"
34 print "-a|--asmfile [FILE] Assembly code source file"
35 print "-d|--defs [DIR] Directory containing the defs files"
37 print "The options -d and -a are essential."
38 print "The \"include\" directory can be used for --defs"
48 (opts, args) = getopt.getopt(sys.argv[1:],
50 [ "help", "asmfile=", "defs=" ])
51 except getopt.GetoptError:
56 if o in ("-h", "--help"):
59 if o in ("-a", "--asmfile"):
61 if o in ("-d", "--defs"):
65 print "Must provide --asmfile"
68 print "Must provide --defs"
75 asm = file(opt_asmfile).read()
77 print "Could not read asmfile %s: %s" % (e.filename, e.strerror)
80 b = B43Beautifier(asm, opt_defsfiles)
81 sys.stdout.write(b.getAsm())
86 if __name__ == "__main__":