summaryrefslogtreecommitdiff
path: root/tools/trace/trace.py
diff options
context:
space:
mode:
authorNélio Laranjeiro2009-03-06 22:57:57 +0100
committerNélio Laranjeiro2009-03-06 22:57:57 +0100
commitda91bb6d1ec2edda204eb50bb1ec6a0e00a4d557 (patch)
treeb371eb2d6f1d95fc1f194685e46613b80954b03c /tools/trace/trace.py
parent436b7c13b108822978c019471675e81297693874 (diff)
tools/trace: Ended the interpretor part of the trace tool.
Diffstat (limited to 'tools/trace/trace.py')
-rw-r--r--tools/trace/trace.py55
1 files changed, 20 insertions, 35 deletions
diff --git a/tools/trace/trace.py b/tools/trace/trace.py
index 86bffb35..6850a4cd 100644
--- a/tools/trace/trace.py
+++ b/tools/trace/trace.py
@@ -1,45 +1,30 @@
#!/bin/usr/env python
+from optparse import OptionParser
import sys
+sys.path.append ('../../host/')
from tcreator.tcreator import *
from tinter.tinter import *
-def create_parse_args(list = None):
- infile = ""
- outfile = ""
- enum_name = ""
- if list == None:
- return None
- else:
- for i in range (0, len(list)):
- if list[i] == "-e":
- enum_name = list[i+1]
- if list[i] == "-o":
- outfile = list[i+1]
- else:
- infile = list[i]
- return [infile, outfile, enum_name]
+print "Trace System v1.0 by APBTeam\n"
+parser = OptionParser()
+parser.add_option("-e", "--enum-name", dest="enum_name",
+ help="provide the enumerator name", metavar="ENUM")
+parser.add_option("-o", "--output", dest="outfile",
+ help="Store the eunerator on the output file")
+parser.add_option("-i", "--infile", dest="infile",
+ help="Read the data from the file")
+parser.add_option("-t", "--type", dest="type",
+ help="create to create the enumeration, inter to read the log from the flash.")
-print "Trace System v1.0 by APBTeam\n"
+[options, args] = parser.parse_args()
-if len(sys.argv) > 1:
- argc = len(sys.argv)
- if sys.argv[1] == "create":
- if (argc >= 2) and (argc <= 7):
- data = create_parse_args(sys.argv)
- cre = TCreator (data[0], data[1], data[2])
- cre.create ()
- else:
- raise Exception ("Not enough arguments")
- if sys.argv[1] == "inter":
- if argc >= 2:
- inter = TInter (sys.argv[2])
- if argc == 2:
- inter.trace_print(None)
- else:
- inter.trace_print(sys.argv[3])
- else:
- raise Exception ("Not enough arguments")
+if options.type == 'create':
+ cre = TCreator (options.infile, options.outfile, options.enum_name)
+ cre.create ()
+elif options.type == "inter":
+ inter = TInter (options.infile, options.outfile)
+ inter.trace_print()
else:
- raise Exception ("Not enough arguments")
+ print "see the help\n python trace --help"