Update of /cvsroot/csp/APPLICATIONS/CSPSim/Tools/HID
In directory sc8-pr-cvs1:/tmp/cvs-serv31012
Modified Files:
map2hid
Log Message:
Index: map2hid
===================================================================
RCS file: /cvsroot/csp/APPLICATIONS/CSPSim/Tools/HID/map2hid,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** map2hid 27 Mar 2003 03:15:31 -0000 1.3
--- map2hid 24 Jul 2003 08:34:36 -0000 1.4
***************
*** 476,529 ****
self.mapping = {}
! def usage():
print "Map script to human interface device definition converter"
print "Copyright (C) 2003 Mark Rose <tm...@st...>"
! print "usage: %s [--help] infile [outfile]" % sys.argv[0]
- file = None
- outfile = None
! for arg in sys.argv[1:]:
! if arg.startswith('--'):
! if arg == '--help':
! usage()
! print " infile : input map file"
! print " outfile : output file ('-' for stdout)"
sys.exit(1)
! continue
if file is None:
! file = arg
! elif outfile is None:
! outfile = arg
! else:
! usage()
sys.exit(1)
!
! if outfile is None and file.endswith('.map'):
! outfile = file[:-4] + '.hid'
- outf = None
- if outfile == '-':
- outf = sys.stdout
- else:
try:
! outf = open(outfile, "wt")
! except:
! print "Unable to write to '%s'." % outfile
sys.exit(1)
-
- v = VirtualDeviceDefinition()
! try:
! v.read(file)
! except Error, e:
! print e.msg
! sys.exit(1)
! bindings = v.bind.keys()
! bindings.sort()
! for b in bindings:
! print >>outf, "=%s" % b
! for m in v.maps:
! m.write(outf)
--- 476,539 ----
self.mapping = {}
! def usage(program):
print "Map script to human interface device definition converter"
print "Copyright (C) 2003 Mark Rose <tm...@st...>"
! print "usage: %s [--help] infile [outfile]" % program
! def main(argv):
! file = None
! outfile = None
!
! for arg in argv[1:]:
! if arg.startswith('--'):
! if arg == '--help':
! usage(argv[0])
! print " infile : input map file"
! print " outfile : output file ('-' for stdout)"
! sys.exit(1)
! continue
! if file is None:
! file = arg
! elif outfile is None:
! outfile = arg
! else:
! usage(argv[0])
sys.exit(1)
!
if file is None:
! usage(argv[0])
sys.exit(1)
!
! if outfile is None and file.endswith('.map'):
! outfile = file[:-4] + '.hid'
!
! outf = None
! if outfile == '-':
! outf = sys.stdout
! else:
! try:
! outf = open(outfile, "wt")
! except:
! print "Unable to write to '%s'." % outfile
! sys.exit(1)
!
! v = VirtualDeviceDefinition()
try:
! v.read(file)
! except Error, e:
! print e.msg
sys.exit(1)
! bindings = v.bind.keys()
! bindings.sort()
! for b in bindings:
! print >>outf, "=%s" % b
! for m in v.maps:
! m.write(outf)
!
! if __name__ == "__main__":
! main(sys.argv)
|